]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agotests: old automake lacks abs_builddir
Eric Blake [Tue, 26 Feb 2013 16:40:38 +0000 (09:40 -0700)]
tests: old automake lacks abs_builddir

On RHEL 5, 'make check' included failures such as:

TEST: virstoragetest
unable to create directory /virstoragedata/sub
unable to return to correct directory, refusing to clean up /virstoragedata

It turns out that with automake 1.9.x, $(abs_builddir) is not
automatically provided.  We have previously worked around this
by using `pwd` before, but because we did not do it everywhere,
we had a number of broken tests.

This patch brings RHEL 5 from 8 failed tests down to 5 (the
remaining failures may be due to bugs in the older libxml2 and
RNG schema validation available in RHEL 5, so I'm not sure if
they can be fixed in libvirt, but I'm still investigating).

* tests/Makefile.am (AM_CFLAGS): Reliably set abs_builddir.
(*_la_CFLAGS): Factor out common settings; delete when nothing
remains to be added.

12 years agotests: consistent skip messages
Eric Blake [Tue, 26 Feb 2013 16:36:27 +0000 (09:36 -0700)]
tests: consistent skip messages

On RHEL 5, I noticed this test failure message:

TEST: qemumonitorjsontest
libvirt not compiled with yajl, skippingSKIP: qemumonitorjsontest

* tests/virstoragetest.c (testPrepImages): Use simpler fputs.
* tests/qemumonitorjsontest.c (mymain): Ensure trailing newline.

12 years agolibvirt: fix error message when connection can't be opened
Ján Tomko [Tue, 26 Feb 2013 12:00:08 +0000 (13:00 +0100)]
libvirt: fix error message when connection can't be opened

VIR_ERR_NO_CONNECT already contains "no connection driver available".

This patch changes:
no connection driver available for No connection for URI hello
to:
no connection driver available for hello

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=851413

12 years agoqemu: do not set unpriv_sgio if neither supported nor requested
Paolo Bonzini [Mon, 25 Feb 2013 16:38:32 +0000 (17:38 +0100)]
qemu: do not set unpriv_sgio if neither supported nor requested

Currently we call virSetDeviceUnprivSGIO with val == 0 if a block device
has an sgio attribute.  But for sgio='filtered', we know that a
kernel with no unpriv_sgio support will always behave as the user
wanted.  In this case, there is no need to call the function and
report a (bogus) error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agotests: uniformly report test failures
Eric Blake [Fri, 22 Feb 2013 22:42:39 +0000 (15:42 -0700)]
tests: uniformly report test failures

testutils.c likes to print summaries after a test completes,
including if it failed.  But if the test outright exit()s,
this summary is skipped.  Enforce that we return instead of exit.

* cfg.mk (sc_prohibit_exit_in_tests): New syntax check.
* tests/commandhelper.c (main): Fix offenders.
* tests/qemumonitorjsontest.c (mymain): Likewise.
* tests/seclabeltest.c (main): Likewise.
* tests/securityselinuxlabeltest.c (mymain): Likewise.
* tests/securityselinuxtest.c (mymain): Likewise.
* tests/testutils.h (VIRT_TEST_MAIN_PRELOAD): Likewise.
* tests/testutils.c (virtTestMain): Likewise.
(virtTestCaptureProgramOutput): Use symbolic name.

12 years agotests: don't test json when not compiled in
Eric Blake [Fri, 22 Feb 2013 22:28:53 +0000 (15:28 -0700)]
tests: don't test json when not compiled in

Now that the segfault is solved, we can skip instead of fail
the test when yajl is not present.

* tests/qemumonitorjsontest.c (mymain): Skip if no yajl.

12 years agotests: avoid segfault if json monitor not present
Eric Blake [Fri, 22 Feb 2013 21:56:21 +0000 (14:56 -0700)]
tests: avoid segfault if json monitor not present

On a machine without yajl headers, I was seeing random segfaults
from qemumonitorjsontest (about 90% of the runs on my particular
machine).  The segfault was inside virClassIsDerivedFrom, which
points to a case of a race leading to unreferencing a stale
pointer to an object that had already been freed.  I also noticed
that if I got the segfault, I was seeing messages such as:

2013-02-22 16:12:37.504+0000: 19833: error : virNetSocketWriteWire:1361 : Cannot write data: Bad file descriptor

which is also evidence of deferencing a stale pointer.  I traced it
to a race where qemuMonitorTestIO could execute late, after the
main thread had already called qemuMonitorTestFree and called
virNetSocketClose(test->client) but not clearing it out to NULL.
Sure enough, after test->client has been closed, fd is -1, which
causes an attempt to write to the socket to fail, which in turn
triggers the error code of qemuMonitorTestIO that tries to re-close
test->client.

* tests/qemumonitortestutils.c (qemuMonitorTestIO): Don't attempt
to free client again if test already quit.

12 years agoqemu: minor monitor lock cleanups
Eric Blake [Fri, 22 Feb 2013 20:19:43 +0000 (13:19 -0700)]
qemu: minor monitor lock cleanups

If virCondInit fails (okay, so that's unlikely), then we end up
attempting a virObjectUnlock() on the cleanup path, even though
we don't hold a lock.  This is not guaranteed to be safe.  While
at it, I noticed a couple places where we were referencing mon->fd
outside locks.

* src/qemu/qemu_monitor.c (qemuMonitorOpenInternal): Minimize lock
duration.  mon->watch doesn't need clean up on error.
(qemuMonitorGetBlockExtent, qemuMonitorBlockResize): Don't
dereference fd outside of lock.

12 years agoqemu: don't override earlier json error
Eric Blake [Fri, 22 Feb 2013 16:41:38 +0000 (09:41 -0700)]
qemu: don't override earlier json error

I built without yajl support, and noticed a strange failure message
in qemumonitorjsontest:

2013-02-22 16:12:37.503+0000: 19812: error : virJSONValueToString:1119 : internal error No JSON parser implementation is available
2013-02-22 16:12:37.503+0000: 19812: error : qemuMonitorJSONCommandWithFd:253 : out of memory

While a later patch will fix the test to skip when json is not present,
this patch avoids overriding the more useful error message from
virJSONValueToString returning NULL.

* src/qemu/qemu_monitor_json.c (qemuMonitorJSONCommandWithFd):
Don't override message.
(qemuMonitorJSONCheckError): Don't print NULL.
* src/qemu/qemu_agent.c (qemuAgentCommand): Don't override message.
(qemuAgentCheckError): Don't print NULL.
(qemuAgentArbitraryCommand): Properly fail on OOM.

12 years agoconf: Avoid leaking of RNG device definition
Peter Krempa [Mon, 25 Feb 2013 21:31:11 +0000 (22:31 +0100)]
conf: Avoid leaking of RNG device definition

12 years agoqemu: Refactor qemuDomainSetMemoryParameters
Peter Krempa [Mon, 18 Feb 2013 15:13:04 +0000 (16:13 +0100)]
qemu: Refactor qemuDomainSetMemoryParameters

The new TypedParam helper APIs allow to simplify this function
significantly.

This patch integrates the fix in 75e5bec97b3045e4f926248d5c742f8a50d0f9
by correctly ordering the setting functions instead of reordering the
parameters.

12 years agointerface: Fix udev backend bridge device display
Doug Goldstein [Mon, 25 Feb 2013 02:31:03 +0000 (20:31 -0600)]
interface: Fix udev backend bridge device display

The bridge device was showing the vnet devices created for the domains
as connected to the bridge. libvirt should only show host devices when
trying to get the interface definition rather than the domain devices as
well.

12 years agostorage: cast -1 for uid_t|gid_t
Philipp Hahn [Fri, 22 Feb 2013 16:41:32 +0000 (17:41 +0100)]
storage: cast -1 for uid_t|gid_t

uid_t and gid_t are opaque types, ranging from s32 to u32 to u64.

Explicitly cast the magic -1 to the appropriate type.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agostorage: Cast uid_t|gid_t to unsigned int
Philipp Hahn [Fri, 22 Feb 2013 16:43:15 +0000 (17:43 +0100)]
storage: Cast uid_t|gid_t to unsigned int

uid_t and gid_t are opaque types, ranging from s32 to u32 to u64.

Explicitly cast them to unsigned int for printing.

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agoutil: Fix printf format for uid_t|gid_t
Philipp Hahn [Fri, 22 Feb 2013 16:36:30 +0000 (17:36 +0100)]
util: Fix printf format for uid_t|gid_t

The uid_t|gid_t values are explicitly casted to "unsigned long", but the
printf() still used "%d", which is for signed values.

Change the format to "%u".

Signed-off-by: Philipp Hahn <hahn@univention.de>
12 years agotests: Add tests for virtio-rng device handling
Peter Krempa [Tue, 12 Feb 2013 16:56:00 +0000 (17:56 +0100)]
tests: Add tests for virtio-rng device handling

Adds XML parsing and qemu commandline tests for the VirtIO RNG device
support.

12 years agoqemu: Implement support for EGD backend for virtio-rng
Peter Krempa [Wed, 13 Feb 2013 10:22:23 +0000 (11:22 +0100)]
qemu: Implement support for EGD backend for virtio-rng

This patch adds a new capability bit QEMU_CAPS_OBJECT_RNG_EGD and code
to support the egd backend for the VirtIO RNG device.

The device is added by 3 qemu command line options:
-chardev socket,id=charrng0,host=1.2.3.4,port=1234 (communication
                                                    backend)
-object rng-egd,chardev=charrng0,id=rng0 (RNG protocol client)
-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4 (the RNG device)

12 years agoqemu: Implement support for default 'random' backend for virtio-rng
Peter Krempa [Fri, 11 Jan 2013 16:48:21 +0000 (17:48 +0100)]
qemu: Implement support for default 'random' backend for virtio-rng

This patch implements support for the virtio-rng-pci device and the
rng-random backend in qemu.

Two capabilities bits are added to track support for those:

QEMU_CAPS_DEVICE_VIRTIO_RNG - for the device support and
QEMU_CAPS_OBJECT_RNG_RANDOM - for the backend support.

qemu is invoked with these additional parameters if the device is
enabled:

-object rng-random,id=rng0,filename=/test/phile (to add the backend)
-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4 (to add the device)

12 years agoconf: Add RNG device ABI compatibility check
Peter Krempa [Thu, 7 Feb 2013 15:27:44 +0000 (16:27 +0100)]
conf: Add RNG device ABI compatibility check

12 years agoconf: Add support for RNG device configuration in XML
Peter Krempa [Fri, 11 Jan 2013 16:34:37 +0000 (17:34 +0100)]
conf: Add support for RNG device configuration in XML

This patch adds basic configuration support for the RNG device
supporting the virtio model with the "random" and "egd" backend types as
described in the schema in the previous patch.

12 years agodoc: schema: Add basic documentation for the virtual RNG device support
Peter Krempa [Thu, 20 Dec 2012 11:06:52 +0000 (12:06 +0100)]
doc: schema: Add basic documentation for the virtual RNG device support

This patch documents XML elements used for (basic) support of virtual
RNG devices.

In the devices section in the domain XML users may specify:

For the default 'random' backend:
  <devices>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
    </rng>
  </devices>

For the slightly more advanced EGD backend:
  <devices>
    <rng model='virtio'>
      <backend model='egd' type='udp'>
        <!-- this is a definition of a character device -->
        <source mode='bind' service='1234'/>
        <source mode='connect' host='1.2.3.4' service='1234'/>
        <!-- or other valid character device configuration -->
      </backend>
    </rng>
  </devices>

For the planned random daemon/pool:
  <devices>
    <rng model='virtio'>
      <backend model='pool' pool='poolname'>class</backend>
    </rng>
  </devices>

to enable the RNG device for guests.

12 years agoconf: Add fake switch statement to warn for new device types
Peter Krempa [Thu, 21 Feb 2013 11:37:59 +0000 (12:37 +0100)]
conf: Add fake switch statement to warn for new device types

This patch adds a fake switch statement to force the compiler to warn
after a new device type was added. This should remind the contributor to
add the new device also to this iterator function.

12 years agouse client id for IPv6 DHCP host definition
Gene Czarcinski [Fri, 15 Feb 2013 19:02:26 +0000 (14:02 -0500)]
use client id for IPv6 DHCP host definition

Originally, only a host name was used to associate a
DHCPv6 request with a specific IPv6 address.  Further testing
demonstrates that this is an unreliable method and, instead,
a client-id or DUID needs to be used.  According to DHCPv6
standards, this id can be a duid-LLT, duid-LL, or duid-UUID
even though dnsmasq will accept almost any text string.

Although validity checking of a specified string makes sure it is
hexadecimal notation with bytes separated by colons, there is no
rigorous check to make sure it meets the standard.

Documentation and schemas have been updated.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
Signed-off-by: Laine Stump <laine@laine.org>
12 years agoTrivial fix: in dhcp-host the name is optional
Gene Czarcinski [Fri, 15 Feb 2013 19:02:25 +0000 (14:02 -0500)]
Trivial fix: in dhcp-host the name is optional

Although in IPv4 one must pick either mac or name, either
can be omitted.  Similarly, for IPv6, the name
can be optionally omitted.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
Signed-off-by: Laine Stump <laine@laine.org>
12 years agoutil: fix typo in comment
Laine Stump [Sat, 23 Feb 2013 15:30:38 +0000 (10:30 -0500)]
util: fix typo in comment

12 years agostorage: qemu-img: change INFO to DEBUG
Ján Tomko [Mon, 18 Feb 2013 13:48:20 +0000 (14:48 +0100)]
storage: qemu-img: change INFO to DEBUG

For really old qemu-img binaries which do not support specifying
the format of the backing file, display a DEBUG message instead of
INFO that this can't be done.

12 years agostorage: move qemu-img options before positional arguments
Ján Tomko [Mon, 18 Feb 2013 13:45:03 +0000 (14:45 +0100)]
storage: move qemu-img options before positional arguments

Modify the expected output of storagevolxml2argv tests as well.

12 years agostorage: add test for qemu-img command line generation
Ján Tomko [Mon, 18 Feb 2013 12:43:28 +0000 (13:43 +0100)]
storage: add test for qemu-img command line generation

12 years agostorage: separate qemu-img command generation and execution
Ján Tomko [Mon, 18 Feb 2013 11:52:58 +0000 (12:52 +0100)]
storage: separate qemu-img command generation and execution

This allows us to create a test for the generated command line.

12 years agostorage: move flag setting after declarations
Ján Tomko [Mon, 18 Feb 2013 11:50:46 +0000 (12:50 +0100)]
storage: move flag setting after declarations

12 years agorun: license as LGPL
Eric Blake [Sat, 23 Feb 2013 00:10:48 +0000 (17:10 -0700)]
run: license as LGPL

It makes no sense to prohibit reuse of the wrapper in other LGPL
projects, since most of libvirt is designed to be LGPL.  Of
course, when using the wrapper to wrap a GPL program, the combined
result is still effectively GPL, but that shouldn't force us to
license the wrapper as GPL in isolation.

* run.in: Relicense to LGPLv2+.

12 years agoqemu_migration: Cancel running jobs on failed migration
Michal Privoznik [Wed, 30 Jan 2013 16:53:37 +0000 (17:53 +0100)]
qemu_migration: Cancel running jobs on failed migration

If a migration fails, we need to stop all block jobs running so
qemu doesn't try to send data to destination over and over again.

12 years agoqemu_migration: Stop NBD server at Finish phase
Michal Privoznik [Tue, 27 Nov 2012 15:34:24 +0000 (16:34 +0100)]
qemu_migration: Stop NBD server at Finish phase

At the end of migration, it is important to stop NBD
server and thus release all allocated resources.

12 years agoqemu_migration: Introduce qemuMigrationDriveMirror
Michal Privoznik [Fri, 23 Nov 2012 14:42:51 +0000 (15:42 +0100)]
qemu_migration: Introduce qemuMigrationDriveMirror

This function does the source part of NBD magic. It
invokes drive-mirror on each non shared and RW disk with
a source and wait till the mirroring process completes.
When it does we can proceed with migration.

Currently, an active waiting is done: every 500ms libvirt
asks qemu if block-job is finished or not.  However, once
the job finishes, qemu doesn't report its progress so we
can only assume if the job finished successfully or not.
The better solution would be to listen to the event which
is sent as soon as the job finishes. The event does
contain the result of job.

12 years agoqemu_migration: Introduce qemuMigrationStartNBDServer()
Michal Privoznik [Thu, 31 Jan 2013 13:48:06 +0000 (14:48 +0100)]
qemu_migration: Introduce qemuMigrationStartNBDServer()

We need to start NBD server and feed it with all non-<shared/>,
RW and source-full disks. Moreover, with new virPortAllocator we
must ensure the borrowed port for NBD server will be returned if
either migration completes or qemu process is torn down.

12 years agoqemu: Introduce nbd-server-stop command
Michal Privoznik [Thu, 31 Jan 2013 13:47:49 +0000 (14:47 +0100)]
qemu: Introduce nbd-server-stop command

This will be used after all migration work is done
to stop NBD server running on destination.  It
doesn't take any arguments, just issues a command.

12 years agoqemu: Introduce nbd-server-add command
Michal Privoznik [Thu, 22 Nov 2012 15:17:13 +0000 (16:17 +0100)]
qemu: Introduce nbd-server-add command

This will be used with new migration scheme.
This patch creates basically just monitor stub
functions. Wiring them into something useful
is done in later patches.

12 years agoqemu: Introduce nbd-server-start command
Michal Privoznik [Thu, 22 Nov 2012 15:08:52 +0000 (16:08 +0100)]
qemu: Introduce nbd-server-start command

This will be used with new migration scheme.
This patch creates basically just monitor stub
functions. Wiring them into something useful
is done in later patches.

12 years agoIntroduce NBD migration cookie
Michal Privoznik [Tue, 29 Jan 2013 12:38:50 +0000 (13:38 +0100)]
Introduce NBD migration cookie

This migration cookie is meant for two purposes. The first is to be sent
in begin phase from source to destination to let it know we support new
implementation of VIR_MIGRATE_NON_SHARED_{DISK,INC} so destination can
start NBD server. Then, the second purpose is, destination can let us
know, on which port the NBD server is running.

12 years agoqemu: Introduce NBD_SERVER capability
Michal Privoznik [Wed, 21 Nov 2012 13:28:44 +0000 (14:28 +0100)]
qemu: Introduce NBD_SERVER capability

This just keeps track whether qemu knows nbd-server-* commands
so we can use it during migration or not.

12 years agoAdd support for <option> tag in network config
Pieter Hollants [Thu, 21 Feb 2013 22:40:17 +0000 (23:40 +0100)]
Add support for <option> tag in network config

This patch adds support for a new <option>-Tag in the <dhcp> block of
network configs, based on a subset of the fifth proposal by Laine
Stump in the mailing list discussion at
https://www.redhat.com/archives/libvir-list/2012-November/msg01054.html.
Any such defined option will result in a dhcp-option=<number>,"<value>"
statement in the generated dnsmasq configuration file.

Currently, DHCP options can be specified by number only and there is
no whitelisting or blacklisting of option numbers, which should
probably be added.

Signed-off-by: Pieter Hollants <pieter@hollants.com>
Signed-off-by: Laine Stump <laine@laine.org>
12 years agorun: use portable shell
Eric Blake [Sat, 23 Feb 2013 00:10:48 +0000 (17:10 -0700)]
run: use portable shell

Nothing in run required bash, except for the shebang.  On systems
where /bin/bash doesn't exist (I hit it on FreeBSD), using /bin/sh
instead fixes a 'make check' failure:
gmake[3]: Entering directory `/usr/home/dummy/libvirt/python'
  GEN    check-local
/usr/local/bin/bash: ../run: /bin/bash: bad interpreter: No such file or directory

* run.in: Use /bin/sh, not bash.

12 years agostorage: use f_frsize, not f_bsize, for calculating available space
Sage Weil [Fri, 22 Feb 2013 23:43:00 +0000 (15:43 -0800)]
storage: use f_frsize, not f_bsize, for calculating available space

The bfree and blocks fields are supposed to be in units of frsize.  We were
calculating capacity correctly using those units, but the available
calculation was using bsize instead.  Most file systems report these as the
same value specifically because many programs are buggy, but that is no
reason to rely on that behavior, or to behave inconsistently.

This bug has been present since e266ded (2008) and aa296e6c, when the code
was originally introduced (the latter via cut and paste).

Signed-off-by: Sage Weil <sage@newdream.net>
12 years agomaint: check all symfiles for sorting
Eric Blake [Fri, 22 Feb 2013 23:46:25 +0000 (16:46 -0700)]
maint: check all symfiles for sorting

On FreeBSD, I got a 'make check' failure:
  GEN    check-symsorting
Symbol block at ./libvirt_atomic.syms:4: viratomic.h not found

* src/Makefile.am (SYM_FILES): New define.
(check-symsorting): Check on all symfiles, even when not used.
* src/libvirt_atomic.syms: Fix offender.

12 years agoqemu: Implement virDomainMigrate*CompressionCache
Jiri Denemark [Mon, 18 Feb 2013 20:54:58 +0000 (21:54 +0100)]
qemu: Implement virDomainMigrate*CompressionCache

12 years agovirsh: Add migrate-compcache command
Jiri Denemark [Mon, 18 Feb 2013 20:14:49 +0000 (21:14 +0100)]
virsh: Add migrate-compcache command

This is a command wrapping virDomainMigrateGetCompressionCache and
virDomainMigrateSetCompressionCache.

12 years agoremote: Implement virDomainMigrate*CompressionCache
Jiri Denemark [Mon, 18 Feb 2013 19:20:04 +0000 (20:20 +0100)]
remote: Implement virDomainMigrate*CompressionCache

12 years agopython: Implement virDomainMigrateGetCompressionCache wrapper
Jiri Denemark [Mon, 18 Feb 2013 22:20:48 +0000 (23:20 +0100)]
python: Implement virDomainMigrateGetCompressionCache wrapper

12 years agoIntroduce virDomainMigrate*CompressionCache APIs
Jiri Denemark [Mon, 18 Feb 2013 16:31:08 +0000 (17:31 +0100)]
Introduce virDomainMigrate*CompressionCache APIs

Introduce virDomainMigrateGetCompressionCache and
virDomainMigrateSetCompressionCache APIs.

12 years agoqemu: Implement virDomainGetJobStats
Jiri Denemark [Tue, 12 Feb 2013 19:29:17 +0000 (20:29 +0100)]
qemu: Implement virDomainGetJobStats

12 years agoqemu: Parse more fields from query-migrate QMP command
Jiri Denemark [Fri, 8 Feb 2013 08:58:03 +0000 (09:58 +0100)]
qemu: Parse more fields from query-migrate QMP command

As a side effect, this also fixes reporting disk migration process.
It was added to memory migration progress, which was wrong. Disk
progress has dedicated fields in virDomainJobInfo structure.

12 years agovirsh: Use virDomainGetJobStats in domjobinfo if available
Jiri Denemark [Fri, 8 Feb 2013 08:55:17 +0000 (09:55 +0100)]
virsh: Use virDomainGetJobStats in domjobinfo if available

12 years agoremote: Implement virDomainGetJobStats
Jiri Denemark [Wed, 30 Jan 2013 09:49:28 +0000 (10:49 +0100)]
remote: Implement virDomainGetJobStats

12 years agoremote: Auto-allocate params in remoteDeserializeTypedParameters
Jiri Denemark [Wed, 30 Jan 2013 09:28:54 +0000 (10:28 +0100)]
remote: Auto-allocate params in remoteDeserializeTypedParameters

remoteDeserializeTypedParameters can now be called with either
preallocated params array (size of which is announced by nparams) or it
can allocate params array according to the number of parameters received
from the server.

12 years agopython: Implement virDomainGetJobStats wrapper
Jiri Denemark [Mon, 18 Feb 2013 22:20:08 +0000 (23:20 +0100)]
python: Implement virDomainGetJobStats wrapper

12 years agoIntroduce virDomainGetJobStats API
Jiri Denemark [Fri, 25 Jan 2013 23:30:49 +0000 (00:30 +0100)]
Introduce virDomainGetJobStats API

This is an extensible version of virDomainGetJobInfo.

12 years agoqemu: Add support for compressed migration
Jiri Denemark [Mon, 14 Jan 2013 11:45:20 +0000 (12:45 +0100)]
qemu: Add support for compressed migration

12 years agoIntroduce VIR_MIGRATE_COMPRESSED flag
Jiri Denemark [Thu, 10 Jan 2013 12:39:34 +0000 (13:39 +0100)]
Introduce VIR_MIGRATE_COMPRESSED flag

This flag may be used with migration APIs to request compression of
migration data.

12 years agos/arm/armv7l/ in caps-qemu-kvm.xml
Daniel P. Berrange [Fri, 22 Feb 2013 15:49:51 +0000 (15:49 +0000)]
s/arm/armv7l/ in caps-qemu-kvm.xml

Fix the caps-qemu-kvm.xml test data file to refer to correct
arm arch name.

12 years agoUpdate arch names in RNG schema to match virarch.c
Daniel P. Berrange [Thu, 21 Feb 2013 11:20:25 +0000 (11:20 +0000)]
Update arch names in RNG schema to match virarch.c

When the virarch.c file was introduced to formalize the arch
list, we forgot to update the RNG schema with the new arches.

12 years agoconf: Don't leak 'ram' video property on error
Christophe Fergeau [Thu, 21 Feb 2013 15:21:31 +0000 (16:21 +0100)]
conf: Don't leak 'ram' video property on error

It's only freed on normal returns from virDomainVideoDefParseXML,
but not when erroring out.

12 years agoconf: Don't leak 'primary' video property on error
Christophe Fergeau [Thu, 21 Feb 2013 15:21:31 +0000 (16:21 +0100)]
conf: Don't leak 'primary' video property on error

It's only freed on normal returns from virDomainVideoDefParseXML,
but not when erroring out.

12 years agointerface: dev type support for bond interfaces
Doug Goldstein [Wed, 20 Feb 2013 06:48:56 +0000 (00:48 -0600)]
interface: dev type support for bond interfaces

Patch has been accepted into net-next's 3.9 queue to correctly expose
bond interfaces with the 'bond' devtype.

12 years agointerface: add bond support to udev backend
Doug Goldstein [Sun, 17 Feb 2013 21:34:17 +0000 (15:34 -0600)]
interface: add bond support to udev backend

The udev backend now supports bond interfaces.

12 years agointerface: Improve udev backend device type id
Doug Goldstein [Fri, 15 Feb 2013 22:48:07 +0000 (16:48 -0600)]
interface: Improve udev backend device type id

Refactored the interface device type identification to make it more
clear about the operations. Add support for udev devtype to detect
VLANs on Linux 3.7 and newer. Move VLAN detection based on device
name to fallback case.

12 years agointerface: Refactor interface vlan to helper func
Doug Goldstein [Fri, 15 Feb 2013 22:32:34 +0000 (16:32 -0600)]
interface: Refactor interface vlan to helper func

Mechanical move to break up udevIfaceGetIfaceDef() into different
helpers for each of the interface types to hopefully make the code
easier to follow. This moves the vlan code to
udevIfaceGetIfaceDefVlan().

12 years agointerface: udev bridge code error handling updates
Doug Goldstein [Wed, 20 Feb 2013 06:39:37 +0000 (00:39 -0600)]
interface: udev bridge code error handling updates

Based on feedback from Laine Stump, improve a number of the error
handling cases to report the issue to the user instead of not generating
data or giving vague errors. Added the bridge device name to every error
message as well to make it clear which bridge failed.

12 years agointerface: Refactor udev bridge to helper func
Doug Goldstein [Fri, 15 Feb 2013 16:49:08 +0000 (10:49 -0600)]
interface: Refactor udev bridge to helper func

Mechanical move to break up udevIfaceGetIfaceDef() into different
helpers for each of the interface types to hopefully make the code
easier to follow. This moves the bridge code to
udevIfaceGetIfaceDefBridge().

12 years agoqemu: check backing chains even when cgroup is omitted
Eric Blake [Wed, 20 Feb 2013 22:34:48 +0000 (15:34 -0700)]
qemu: check backing chains even when cgroup is omitted

https://bugzilla.redhat.com/show_bug.cgi?id=896685 points out
a regression caused by commit 38c4a9c - libvirt only labels
the backing chain if the backing chain cache is populated, but
the code to populate the cache was only conditionally performed
if cgroup labeling was necessary.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Hoist cache setup...
* src/qemu/qemu_process.c (qemuProcessStart): ...earlier into
caller, where it is now unconditional.

12 years agodocs: Add missing 'vram' in QXL video device doc
Christophe Fergeau [Thu, 21 Feb 2013 14:59:39 +0000 (15:59 +0100)]
docs: Add missing 'vram' in QXL video device doc

12 years agoconf: Refactor ABI stability checking and break long lines
Peter Krempa [Tue, 19 Feb 2013 13:07:10 +0000 (14:07 +0100)]
conf: Refactor ABI stability checking and break long lines

Get rid of the "identical" variable in the ABI stability checks in favor
of return statements and break or refactor very long lines where
possible.

12 years agoconf: Refactor cpumask handling
Peter Krempa [Tue, 19 Feb 2013 10:51:11 +0000 (11:51 +0100)]
conf: Refactor cpumask handling

Declare local variables at the start of the block and fix trivial
formatting issues.

12 years agoconf: Reformat many function headers in domain_conf.c
Peter Krempa [Tue, 19 Feb 2013 10:50:03 +0000 (11:50 +0100)]
conf: Reformat many function headers in domain_conf.c

Many of the headers were using the old style and even overflowing the 80
column mark.

12 years agoconf: Fix label naming in virDomainDefFormatInternal
Peter Krempa [Tue, 19 Feb 2013 10:46:45 +0000 (11:46 +0100)]
conf: Fix label naming in virDomainDefFormatInternal

The label named "cleanup" was used in error cases only. Change it to
"error".

12 years agoconf: Ensure that new devices are added to conf copy function
Peter Krempa [Tue, 19 Feb 2013 10:08:05 +0000 (11:08 +0100)]
conf: Ensure that new devices are added to conf copy function

Use the correct type and get rid of "default" label in switch to make
the compiler complain if a new device type is added.

12 years agoqemu: Refactor error paths in virQEMUDriverCreateCapabilities
Peter Krempa [Tue, 19 Feb 2013 09:56:06 +0000 (10:56 +0100)]
qemu: Refactor error paths in virQEMUDriverCreateCapabilities

Change the error label to "error" and simplify some error paths.

12 years agoconf: Improve core dump config error message
Peter Krempa [Wed, 20 Feb 2013 15:31:14 +0000 (16:31 +0100)]
conf: Improve core dump config error message

The message didn't seem to be much helpful

12 years agodocs: Fix HTML errors
Jiri Denemark [Thu, 21 Feb 2013 09:32:36 +0000 (10:32 +0100)]
docs: Fix HTML errors

<pre> is forbidden inside <p>

12 years agoqemu: Avoid deadlock in autodestroy
Jiri Denemark [Fri, 15 Feb 2013 14:11:47 +0000 (15:11 +0100)]
qemu: Avoid deadlock in autodestroy

Since closeCallbacks were turned into virObjectLockable, we can no
longer call virQEMUCloseCallbacks APIs from within a registered close
callback.

12 years agoqemu: Turn closeCallbacks into virObjectLockable
Jiri Denemark [Fri, 15 Feb 2013 12:05:12 +0000 (13:05 +0100)]
qemu: Turn closeCallbacks into virObjectLockable

To avoid having to hold the qemu driver lock while iterating through
close callbacks and calling them. This fixes a real deadlock when a
domain which is being migrated from another host gets autodestoyed as a
result of broken connection to the other host.

12 years agoqemu: fix an off-by-one error in qemuDomainGetPercpuStats
Guannan Ren [Wed, 20 Feb 2013 11:28:13 +0000 (19:28 +0800)]
qemu: fix an off-by-one error in qemuDomainGetPercpuStats

The max value of number of cpus to compute(id) should not
be equal or greater than max cpu number.
The bug ocurrs when id value is equal to max cpu number which
leads to the off-by-one error in the following for loop.

 # virsh  cpu-stats guest --start 1
 error: Failed to virDomainGetCPUStats()

 error: internal error cpuacct parse error

12 years agoqemu: Fix the memory leak
Osier Yang [Thu, 21 Feb 2013 02:32:15 +0000 (10:32 +0800)]
qemu: Fix the memory leak

Found by John Ferlan (coverity script)

12 years agokeepalive: Guard against integer overflow
John Ferlan [Tue, 5 Feb 2013 22:58:25 +0000 (17:58 -0500)]
keepalive: Guard against integer overflow

Don't allow interval to be > MAX_INT/1000 in virKeepAliveStart()

Guard against possible overflow in virKeepAliveTimeout() by setting the
timeout to be MAX_INT/1000 since the math following will multiply it by 1000.

12 years agolibxl: Fix setting of disk backend
Jim Fehlig [Wed, 20 Feb 2013 20:02:28 +0000 (13:02 -0700)]
libxl: Fix setting of disk backend

The libxl driver was setting the backend field of libxl_device_disk
structure to LIBXL_DISK_BACKEND_TAP when the driver element of disk
configuration was not specified.  This needlessly forces the use of
blktap driver, which may not be loaded in dom0

https://bugzilla.redhat.com/show_bug.cgi?id=912488

Ian Campbell suggested that LIBXL_DISK_BACKEND_UNKNOWN is a better
default in this case

https://www.redhat.com/archives/libvir-list/2013-February/msg01126.html

12 years agoRemove a couple of misplaced VIR_FREE
John Ferlan [Wed, 20 Feb 2013 17:43:00 +0000 (12:43 -0500)]
Remove a couple of misplaced VIR_FREE

12 years agoqemu: Run lzop with '--ignore-warn'
Michal Privoznik [Tue, 19 Feb 2013 17:07:58 +0000 (18:07 +0100)]
qemu: Run lzop with '--ignore-warn'

Currently, if lzop decompression binary produces a warning, it
doesn't exit with zero status but 2 instead. Terrifying, but
true. However, warnings may be ignored using '--ignore-warn'
command line argument.  Moreover, in which case, the exit status
will be zero.

12 years agoFix memory leak in virNetClientIOWriteMessage
Sergey Fionov [Sun, 17 Feb 2013 14:20:59 +0000 (18:20 +0400)]
Fix memory leak in virNetClientIOWriteMessage

Commit 18937c3ae0990b4417a43aa07a2c35aaf8cb6ec2 introduced the
memory leak when client->msg.fds is copied to thecall->msg
and then never freed.

12 years agoqemu: Remove the shared disk entry if the operation is ejecting or updating
Osier Yang [Tue, 19 Feb 2013 12:27:45 +0000 (20:27 +0800)]
qemu: Remove the shared disk entry if the operation is ejecting or updating

For both AttachDevice and UpdateDevice APIs, if the disk device
is 'cdrom' or 'floppy', the operations could be ejecting, updating,
and inserting. For either ejecting or updating, the shared disk
entry of the original disk src has to be removed, because it's
not useful anymore.

And since the original disk def will be changed, new disk def passed
as argument will be free'ed in qemuDomainChangeEjectableMedia, so
we need to copy the orignal disk def before
qemuDomainChangeEjectableMedia, to use it for qemuRemoveSharedDisk.

12 years agoqemu: Move the shared disk adding and sgio setting prior to attaching
Osier Yang [Tue, 19 Feb 2013 12:27:44 +0000 (20:27 +0800)]
qemu: Move the shared disk adding and sgio setting prior to attaching

The disk def could be free'ed by qemuDomainChangeEjectableMedia,
which can thus cause crash if we reference the disk pointer. On
the other hand, we have to remove the added shared disk entry from
the table on error codepath.

12 years agoqemu: Update shared disk table when reconnecting qemu process
Osier Yang [Tue, 19 Feb 2013 12:27:43 +0000 (20:27 +0800)]
qemu: Update shared disk table when reconnecting qemu process

12 years agoqemu: Record names of domain which uses the shared disk in hash table
Osier Yang [Wed, 20 Feb 2013 07:43:55 +0000 (15:43 +0800)]
qemu: Record names of domain which uses the shared disk in hash table

The hash entry is changed from "ref" to {ref, @domains}. With this, the
caller can simply call qemuRemoveSharedDisk, without afraid of removing
the entry belongs to other domains. qemuProcessStart will obviously
benifit from it on error codepath (which calls qemuProcessStop to do
the cleanup).

12 years agoqemu: Merge qemuCheckSharedDisk into qemuAddSharedDisk
Osier Yang [Tue, 19 Feb 2013 12:27:41 +0000 (20:27 +0800)]
qemu: Merge qemuCheckSharedDisk into qemuAddSharedDisk

Based on moving various checking into qemuAddSharedDisk, this
avoids the caller using it in wrong ways. Also this adds two
new checking for qemuCheckSharedDisk (disk device not 'lun'
and kernel doesn't support unpriv_sgio simply returns 0).

12 years agoqemu: Add checking in helpers for sgio setting
Osier Yang [Tue, 19 Feb 2013 12:27:40 +0000 (20:27 +0800)]
qemu: Add checking in helpers for sgio setting

This moves the various checking into the helpers, to avoid the
callers missing the checking.

12 years agomaint: enforce private symbol section sorting
Eric Blake [Wed, 20 Feb 2013 00:59:20 +0000 (17:59 -0700)]
maint: enforce private symbol section sorting

Automating a sorting check is the only way to ensure we don't
regress.  Suggested by Dan Berrange.

* src/check-symsorting.pl (check_sorting): Add a parameter,
validate that groups are in order, and that files exist.
* src/Makefile.am (check-symsorting): Adjust caller.
* src/libvirt_private.syms: Fix typo.
* src/libvirt_linux.syms: Fix file name.
* src/libvirt_vmx.syms: Likewise.
* src/libvirt_xenxs.syms: Likewise.
* src/libvirt_sasl.syms: Likewise.
* src/libvirt_libssh2.syms: Likewise.
* src/libvirt_esx.syms: Mention file name.
* src/libvirt_openvz.syms: Likewise.

12 years agoqemu: Do not ignore mandatory features in migration cookie
Jiri Denemark [Wed, 20 Feb 2013 09:30:38 +0000 (10:30 +0100)]
qemu: Do not ignore mandatory features in migration cookie

Due to "feature"/"features" nasty typo, any features marked as mandatory
by one side of a migration are silently considered optional by the other
side. The following is the code that formats mandatory features in
migration cookie:

    for (i = 0 ; i < QEMU_MIGRATION_COOKIE_FLAG_LAST ; i++) {
        if (mig->flagsMandatory & (1 << i))
            virBufferAsprintf(buf, "  <feature name='%s'/>\n",
                              qemuMigrationCookieFlagTypeToString(i));
    }

12 years agoqemu: switch PCI address alocation to use virDevicePCIAddress
Ján Tomko [Fri, 15 Feb 2013 06:48:49 +0000 (07:48 +0100)]
qemu: switch PCI address alocation to use virDevicePCIAddress

Some functions were using virDomainDeviceInfo where virDevicePCIAddress
would suffice. Some were only using integers for slots and functions,
assuming the bus numbers are always 0.

Switch from virDomainDeviceInfoPtr to virDevicePCIAddressPtr:
qemuPCIAddressAsString
qemuDomainPCIAddressCheckSlot
qemuDomainPCIAddressReserveAddr
qemuDomainPCIAddressReleaseAddr

Switch from int slot to virDevicePCIAddressPtr:
qemuDomainPCIAddressReserveSlot
qemuDomainPCIAddressReleaseSlot
qemuDomainPCIAddressGetNextSlot

Deleted functions (they would take the same parameters
as ReserveAddr/ReleaseAddr do now.)
qemuDomainPCIAddressReserveFunction
qemuDomainPCIAddressReleaseFunction

12 years agovirsh: distinguish errors between missing argument and wrong option
Guannan Ren [Tue, 19 Feb 2013 08:50:59 +0000 (16:50 +0800)]
virsh: distinguish errors between missing argument and wrong option

Specifying ':' to suppress the error messages printed by getopt().
Then, distinguish the two types of errors.

Before:
 # virsh -c
   virsh: option requires an argument -- 'c'
   error: unsupported option '-?'. See --help.

After:
 # virsh -c
   error: option '-c' requires an argument

 # virsh -x
   error: unsupported option '-x'. See --help.

12 years agomaint: sort private syms to reflect recent header renames
Eric Blake [Sat, 16 Feb 2013 03:34:42 +0000 (20:34 -0700)]
maint: sort private syms to reflect recent header renames

Purely mechanical (roughly, s/\n/~/; s/~~/\n/; sort by line;
s/~/\n/)

* src/libvirt_private.syms: Sort sections by header file name.

12 years agomaint: fix header file owners of private symbols
Eric Blake [Sat, 16 Feb 2013 03:25:09 +0000 (20:25 -0700)]
maint: fix header file owners of private symbols

Recent renames were not reflected into the comments of
libvirt_private.syms; furthermore, since we mix private headers from
several directories into this file, knowing where the file lives
can be helpful.

* src/libvirt_private.sym: Reflect recent names.

12 years agonet: use structs for address and port ranges
Natanael Copa [Tue, 19 Feb 2013 10:44:16 +0000 (11:44 +0100)]
net: use structs for address and port ranges

We pass over the address/port start/end values many times so we put
them in structs.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Laine Stump <laine@laine.org>