]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoVMware: Do version detection earlier
Doug Goldstein [Tue, 1 Oct 2013 02:19:13 +0000 (21:19 -0500)]
VMware: Do version detection earlier

Do VMware version detection earlier as future patches will need the
version information to populate capabilities correctly.

11 years agoVMware: Simplify array walk for driver type
Doug Goldstein [Tue, 1 Oct 2013 02:13:17 +0000 (21:13 -0500)]
VMware: Simplify array walk for driver type

Rather than walking the possible driver backends by handle, use a helper
function. Additionally I've done a bit of refactoring in the code over
the past few commits so add myself to the copyright line.

11 years agoqemu: Include listenAddress in debug prints
Michal Privoznik [Fri, 11 Oct 2013 12:15:32 +0000 (14:15 +0200)]
qemu: Include listenAddress in debug prints

After my patches, some functions gained one more argument
(@listenAddress) which wasn't included in debug printing of
arguments they were called with. Functions in question are:
qemuMigrationPrepareDirect and qemuMigrationPerform.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu_migration: Avoid crashing if domain dies too quickly
Michal Privoznik [Tue, 8 Oct 2013 14:50:33 +0000 (16:50 +0200)]
qemu_migration: Avoid crashing if domain dies too quickly

I've noticed a SIGSEGV-ing libvirtd on the destination when the qemu
died too quickly = in Prepare phase. What is happening here is:

1) [Thread 3493] We are in qemuMigrationPrepareAny() and calling
qemuProcessStart() which subsequently calls qemuProcessWaitForMonitor()
and qemuConnectMonitor(). So far so good. The qemuMonitorOpen()
succeeds, however switching monitor to QMP mode fails as qemu died
meanwhile. That is qemuMonitorSetCapabilities() returns -1.

2013-10-08 15:54:10.629+0000: 3493: debug : qemuMonitorSetCapabilities:1356 : mon=0x14a53da0
2013-10-08 15:54:10.630+0000: 3493: debug : qemuMonitorJSONCommandWithFd:262 : Send command '{"execute":"qmp_capabilities","id":"libvirt-1"}' for write with FD -1
2013-10-08 15:54:10.630+0000: 3493: debug : virEventPollUpdateHandle:147 : EVENT_POLL_UPDATE_HANDLE: watch=17 events=13
...
2013-10-08 15:54:10.631+0000: 3493: debug : qemuMonitorSend:956 : QEMU_MONITOR_SEND_MSG: mon=0x14a53da0 msg={"execute":"qmp_capabilities","id":"libvirt-1"}
 fd=-1
2013-10-08 15:54:10.631+0000: 3262: debug : virEventPollRunOnce:641 : Poll got 1 event(s)

2) [Thread 3262] The event loop is trying to do the talking to monitor.
However, qemu is dead already, remember?

2013-10-08 15:54:13.436+0000: 3262: error : qemuMonitorIORead:551 : Unable to read from monitor: Connection reset by peer
2013-10-08 15:54:13.516+0000: 3262: debug : virFileClose:90 : Closed fd 25
...
2013-10-08 15:54:13.533+0000: 3493: debug : qemuMonitorSend:968 : Send command resulted in error internal error: early end of file from monitor: possible problem:

3) [Thread 3493] qemuProcessStart() failed. No big deal. Go to the
'endjob' label and subsequently to the 'cleanup'. Since the domain is
not persistent and ret is -1, the qemuDomainRemoveInactive() is called.
This has an (unpleasant) effect of virObjectUnref()-in the @vm object.
Unpleasant because the event loop which is about to trigger EOF callback
still holds a pointer to the @vm (not the reference). See the valgrind
output below.

4) [Thread 3262] So the event loop starts triggering EOF:

2013-10-08 15:54:13.542+0000: 3262: debug : qemuMonitorIO:729 : Triggering EOF callback
2013-10-08 15:54:13.543+0000: 3262: debug : qemuProcessHandleMonitorEOF:294 : Received EOF on 0x14549110 'migt10'

And the monitor is cleaned up. This results in calling
qemuProcessHandleMonitorEOF with the @vm pointer passed. The pointer is
kept in qemuMonitor struct.

==3262== Thread 1:
==3262== Invalid read of size 4
==3262==    at 0x77ECCAA: pthread_mutex_lock (in /lib64/libpthread-2.15.so)
==3262==    by 0x52FAA06: virMutexLock (virthreadpthread.c:85)
==3262==    by 0x52E3891: virObjectLock (virobject.c:320)
==3262==    by 0x11626743: qemuProcessHandleMonitorEOF (qemu_process.c:296)
==3262==    by 0x11642593: qemuMonitorIO (qemu_monitor.c:730)
==3262==    by 0x52BD526: virEventPollDispatchHandles (vireventpoll.c:501)
==3262==    by 0x52BDD49: virEventPollRunOnce (vireventpoll.c:648)
==3262==    by 0x52BBC68: virEventRunDefaultImpl (virevent.c:274)
==3262==    by 0x542D3D9: virNetServerRun (virnetserver.c:1112)
==3262==    by 0x11F368: main (libvirtd.c:1513)
==3262==  Address 0x14549128 is 24 bytes inside a block of size 136 free'd
==3262==    at 0x4C2AF5C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3262==    by 0x529B1FF: virFree (viralloc.c:580)
==3262==    by 0x52E3703: virObjectUnref (virobject.c:270)
==3262==    by 0x531557E: virDomainObjListRemove (domain_conf.c:2355)
==3262==    by 0x1160E899: qemuDomainRemoveInactive (qemu_domain.c:2061)
==3262==    by 0x1163A0C6: qemuMigrationPrepareAny (qemu_migration.c:2450)
==3262==    by 0x1163A923: qemuMigrationPrepareDirect (qemu_migration.c:2626)
==3262==    by 0x11682D71: qemuDomainMigratePrepare3Params (qemu_driver.c:10309)
==3262==    by 0x53B0976: virDomainMigratePrepare3Params (libvirt.c:7266)
==3262==    by 0x1502D3: remoteDispatchDomainMigratePrepare3Params (remote.c:4797)
==3262==    by 0x12DECA: remoteDispatchDomainMigratePrepare3ParamsHelper (remote_dispatch.h:5741)
==3262==    by 0x54322EB: virNetServerProgramDispatchCall (virnetserverprogram.c:435)

The mon->vm is set in qemuMonitorOpenInternal() which is the correct
place to increase @vm ref counter. The correct place to decrease the ref
counter is then qemuMonitorDispose().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoutil: fix two virCompareLimitUlong bugs
Bing Bu Cao [Fri, 11 Oct 2013 06:50:33 +0000 (14:50 +0800)]
util: fix two virCompareLimitUlong bugs

The helper function virCompareLimitUlong compares limit values,
where value of 0 is equal to unlimited. If the latter parameter is 0,
it should return -1 instead of 1, hence the user can only set hard_limit when
swap_hard_limit currently is unlimited.

Worse, all callers pass 2 64-bit values, but on 32-bit platforms,
the second argument was silently truncated to 32 bits, which
could lead to incorrect computations.

Signed-off-by: Bing Bu Cao <mars@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoMove virNetDevVPort enum impl into virnetdevvportprofile.c
Daniel P. Berrange [Thu, 10 Oct 2013 15:41:05 +0000 (16:41 +0100)]
Move virNetDevVPort enum impl into virnetdevvportprofile.c

The enum for virNetDevVPort is declared in the header file
virnetdevvportprofile.h, but for some reason the impl is
in netdev_vport_profile_conf.c.

This causes a dep from src/util onto src/conf which is not
allowed. Move the enum impl into virnetdevvportprofile.c
to break the circle.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemu_conf: Introduce "migration_address"
Michal Privoznik [Wed, 9 Oct 2013 09:32:55 +0000 (11:32 +0200)]
qemu_conf: Introduce "migration_address"

This configuration knob is there to override default listen address for
-incoming for all qemu domains.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu: Implement support for VIR_MIGRATE_PARAM_LISTEN_ADDRESS
Michal Privoznik [Tue, 8 Oct 2013 12:41:44 +0000 (14:41 +0200)]
qemu: Implement support for VIR_MIGRATE_PARAM_LISTEN_ADDRESS

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirsocket: Introduce virSocketAddrIsWildcard
Michal Privoznik [Wed, 9 Oct 2013 13:10:02 +0000 (15:10 +0200)]
virsocket: Introduce virSocketAddrIsWildcard

This function takes exactly one argument: an address to check.
It returns true, if the address is an IPv4 or IPv6 address in numeric
format, false otherwise (e.g. for "examplehost").

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoMigration: Introduce VIR_MIGRATE_PARAM_LISTEN_ADDRESS
Michal Privoznik [Tue, 8 Oct 2013 11:49:25 +0000 (13:49 +0200)]
Migration: Introduce VIR_MIGRATE_PARAM_LISTEN_ADDRESS

The parameter allows overriding default listen address for '-incoming'
cmd line argument on destination.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu: Introduce qemuDomainDefCheckABIStability
Michal Privoznik [Thu, 10 Oct 2013 08:53:56 +0000 (10:53 +0200)]
qemu: Introduce qemuDomainDefCheckABIStability

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

Whenever we check for ABI stability, we have new xml (e.g. provided by
user, or obtained from snapshot, whatever) which we compare to old xml
and see if ABI won't break. However, if the new xml was produced via
virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
devices, e.g. 'pci-root' controller. Hence, the ABI stability check
fails even though it is stable. Moreover, we can't simply fix
virDomainDefCheckABIStability because removing the correct devices is
task for the driver. For instance, qemu driver wants to remove the usb
controller too, while LXC driver doesn't. That's why we need special
qemu wrapper over virDomainDefCheckABIStability which removes the
correct devices from domain XML, produces MIGRATABLE xml and calls the
check ABI stability function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONSendKey
Michal Privoznik [Wed, 2 Oct 2013 16:23:17 +0000 (18:23 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONSendKey

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetVirtType
Michal Privoznik [Wed, 2 Oct 2013 09:56:43 +0000 (11:56 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetVirtType

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetCPUInfo
Michal Privoznik [Wed, 2 Oct 2013 09:40:33 +0000 (11:40 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetCPUInfo

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Extend the test for yet another monitor commands
Michal Privoznik [Tue, 1 Oct 2013 14:23:50 +0000 (16:23 +0200)]
qemumonitorjsontest: Extend the test for yet another monitor commands

So far, we're unit testing some basic functions and some (so called)
simple functions (e.g. "qmp_capabilities", "system_powerdown"). However,
there are more functions which expect simple "{'return': {}}" reply, but
takes more args to construct the command (for instance "set_link"). This
patch aims on such functions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agostorage_backend: Fix issue with allocation of 0 length volume
John Ferlan [Wed, 9 Oct 2013 13:03:25 +0000 (09:03 -0400)]
storage_backend: Fix issue with allocation of 0 length volume

Commit id '532fef36' added a call to fallocate() and some error
handling based on whether or not the function existed. This new
call resulted in libvirt-cim/cimtest failures when attempting to
create a volume with "0" (zero) allocation value. The failure is
logged as:

Oct  9 07:51:33 localhost libvirtd[8030]: cannot allocate 0 bytes in
file '/var/lib/libvirt/images/cimtest-vol.img': Invalid argument

This can also be seen with virsh vol-create-as:

error: Failed to create vol test
error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
argument

error: Failed to create vol test
error: cannot allocate 0 bytes in file '/home/vm-images/test': Invalid
argument

It turns out fallocate() will return EINVAL when the incoming 'len'
(or allocation) value is 0 (or less).

11 years agoqemu: Init @pcidevs in qemuPrepareHostdevPCIDevices
Michal Privoznik [Thu, 10 Oct 2013 10:32:49 +0000 (12:32 +0200)]
qemu: Init @pcidevs in qemuPrepareHostdevPCIDevices

At the beginning of the function qemuPrepareHostdevPCICheckSupport() is
called. After that @pcidevs is initialized. However, if the very first
command fails, we go to 'cleanup' label where virObjectUnref(pcidevs) is
called. Obviously, it is called before @pcidevs was able to get
initialized. Compiler warns about it:

  CC       qemu/libvirt_driver_qemu_impl_la-qemu_hostdev.lo
qemu/qemu_hostdev.c: In function 'qemuPrepareHostdevPCIDevices':
qemu/qemu_hostdev.c:824:19: error: 'pcidevs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virObjectUnref(pcidevs);
                   ^
cc1: all warnings being treated as errors

11 years agoqemu: Prefer VFIO for PCI device passthrough
Peter Krempa [Fri, 20 Sep 2013 08:39:51 +0000 (10:39 +0200)]
qemu: Prefer VFIO for PCI device passthrough

Prefer using VFIO (if available) to the legacy KVM device passthrough.

With this patch a PCI passthrough device without the driver configured
will be started with VFIO if it's available on the host. If not legacy
KVM passthrough is checked and error is reported if it's not available.

11 years agoqemu: hostdev: Add checks if PCI passthrough is available in the host
Peter Krempa [Thu, 19 Sep 2013 15:01:17 +0000 (17:01 +0200)]
qemu: hostdev: Add checks if PCI passthrough is available in the host

Add code to check availability of PCI passhthrough using VFIO and the
legacy KVM passthrough and use it when starting VMs and hotplugging
devices to live machine.

11 years agoqemu: hostdev: Fix function spacing and header formatting
Peter Krempa [Tue, 8 Oct 2013 13:47:36 +0000 (15:47 +0200)]
qemu: hostdev: Fix function spacing and header formatting

11 years agoqemu: refactor qemuCompressProgramAvailable()
Peter Krempa [Wed, 9 Oct 2013 16:05:13 +0000 (18:05 +0200)]
qemu: refactor qemuCompressProgramAvailable()

11 years agoqemu: Fix coding style in qemuDomainSaveFlags()
Peter Krempa [Wed, 9 Oct 2013 15:39:14 +0000 (17:39 +0200)]
qemu: Fix coding style in qemuDomainSaveFlags()

Avoid mixed brace style in an if statement and fix formatting of error
messages.

11 years agoLXC: Fix handling of RAM filesystem size units
Ján Tomko [Wed, 9 Oct 2013 12:17:13 +0000 (14:17 +0200)]
LXC: Fix handling of RAM filesystem size units

Since 76b644c when the support for RAM filesystems was introduced,
libvirt accepted the following XML:
<source usage='1024' unit='KiB'/>

This was parsed correctly and internally stored in bytes, but it
was formatted as (with an extra 's'):
<source usage='1024' units='KiB'/>
When read again, this was treated as if the units were missing,
meaning libvirt was unable to parse its own XML correctly.

The usage attribute was documented as being in KiB, but it was not
scaled if the unit was missing. Transient domains still worked,
because this was balanced by an extra 'k' in the mount options.

This patch:
Changes the parser to use 'units' instead of 'unit', as the latter
was never documented (fixing persistent domains) and some programs
(libvirt-glib, libvirt-sandbox) already parse the 'units' attribute.

Removes the extra 'k' from the tmpfs mount options, which is needed
because now we parse our own XML correctly.

Changes the default input unit to KiB to match documentation, fixing:
https://bugzilla.redhat.com/show_bug.cgi?id=1015689

11 years agocgroup: fix a comment typo in vircgroup.c
Chen Hanxiao [Wed, 9 Oct 2013 07:09:11 +0000 (15:09 +0800)]
cgroup: fix a comment typo in vircgroup.c

s/shoule/should

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agostorage: Use bool instead of int
Ján Tomko [Mon, 7 Oct 2013 13:57:22 +0000 (15:57 +0200)]
storage: Use bool instead of int

Commit 532fef3 added two-state 'need_alloc' and exposed
'want_sparse' which also only has two states.

Change their type from int to bool.

11 years agotests: Add qemu test for multiple timers
Cole Robinson [Tue, 8 Oct 2013 21:41:16 +0000 (17:41 -0400)]
tests: Add qemu test for multiple timers

The following XML is the recommended default clock configuration for
qemu:

  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>

However we weren't testing any of those timer elements.

11 years agobuild: fix linker error on FreeBSD
Giuseppe Scrivano [Tue, 8 Oct 2013 16:21:04 +0000 (18:21 +0200)]
build: fix linker error on FreeBSD

Commit 2d74822a9eb4856c7f5216bb92bcb76630660f72 renamed
"freebsdNodeGetCPUCount" to "appleFreebsdNodeGetCPUCount", leaving one
call to "freebsdNodeGetCPUCount".  Fix this other case.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: hostdev: Refactor PCI passhrough handling
Peter Krempa [Thu, 19 Sep 2013 14:48:23 +0000 (16:48 +0200)]
qemu: hostdev: Refactor PCI passhrough handling

To simplify future patches dealing with this code, simplify and refactor
some conditions to switch statements.

11 years agoRemove test case average timing
Daniel P. Berrange [Fri, 20 Sep 2013 18:13:35 +0000 (19:13 +0100)]
Remove test case average timing

The test case average timing code has not been used by any test
case ever. Delete it to remove complexity.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove existing OOM test impl
Daniel P. Berrange [Fri, 20 Sep 2013 18:11:02 +0000 (19:11 +0100)]
Remove existing OOM test impl

The current OOM test impl is too inefficient to be used on the
large test suites. It loops running 'main' multiple times, once
for each alloc in the 'main' method. This has complexity
'n * (n + 1) / 2' in terms of total alloc count. It will be
replaced by a more efficient impl whicih runs individual test
cases instead. This will have same complexity but the values
of 'n' will be much smaller, so a net win.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't clobber 'ret' variable in testCompareXMLToXMLHelper
Daniel P. Berrange [Wed, 25 Sep 2013 14:56:05 +0000 (15:56 +0100)]
Don't clobber 'ret' variable in testCompareXMLToXMLHelper

The qemuxml2xmltest.c function testCompareXMLToXMLHelper would
clobber the 'ret' variable causing it to mis-diagnose OOM
errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agovirerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/
Michal Privoznik [Mon, 7 Oct 2013 17:21:47 +0000 (19:21 +0200)]
virerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/

We currently have other error codes in singular form, e.g.
VIR_ERR_NETWORK_EXIST. Cleanup the previous patch to match the form.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agofix a ambiguous output of the command:'virsh vol-create-as'
Hongwei Bi [Mon, 7 Oct 2013 14:04:26 +0000 (22:04 +0800)]
fix a ambiguous output of the command:'virsh vol-create-as'

I created a storage volume(eg: test) from a storage pool(eg:vg10) using
the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
When I re-executed the above command, the output was as the following:
"error: Failed to create vol test
 error: Storage volume not found: storage vol 'test' already exists"

I think the output "Storage volume not found" is not appropriate. Because in fact storage
vol test has been found at this time. And then I think virErrorNumber should includes
VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result
is as following:
"error: Failed to create vol test
 error: storage volume 'test' exists already"

11 years agotests: avoid compile failure on linux kernels older than 2.6.19
Giuseppe Scrivano [Mon, 7 Oct 2013 09:45:00 +0000 (11:45 +0200)]
tests: avoid compile failure on linux kernels older than 2.6.19

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agobuild: add configure --without-readline
Eric Blake [Fri, 4 Oct 2013 17:51:41 +0000 (11:51 -0600)]
build: add configure --without-readline

Make it much easier to test a configuration built without readline
support, by reusing our existing library probe machinery.  It gets
a bit tricky with readline, which does not provide a pkg-config
snippet, and which on some platforms requires one of several
terminal libraries as a prerequiste, but the end result should be
the same default behavior but now with the option to disable things.

* m4/virt-readline.m4 (LIBVIRT_CHECK_READLINE): Simplify by using
LIBVIRT_CHECK_LIB.
* tools/virsh.c: Convert USE_READLINE to WITH_READLINE.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: move readline check into its own macro
Eric Blake [Thu, 2 May 2013 02:54:57 +0000 (20:54 -0600)]
build: move readline check into its own macro

A future patch will allow disabling readline; doing this in an
isolated file instead of configure.ac will make the task easier.

* configure.ac: Move readline code...
* m4/virt-readline.m4: ...here.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: kill maintainer mode, always rebuild by default
Eric Blake [Fri, 4 Oct 2013 22:52:27 +0000 (16:52 -0600)]
build: kill maintainer mode, always rebuild by default

The automake manual recommends against the use of disabling
maintainer mode by default:

https://www.gnu.org/software/automake/manual/automake.html#maintainer_002dmode

because when it is disabled, the user gets no indication if they
touch a file that would normally require a rebuild.  Automake
1.11 changed things so that AM_MAINTAINER_MODE([enable]) will set
the mode to enabled by default; but RHEL 5 still uses automake 1.9,
where AM_MAINTAINER_MODE did not recognize an argument, and
therefore disables maintainer mode by default.  Having the default
be different according to which version of automake built the
project is annoying, and I _have_ been bitten on RHEL 5 rebuilds
where the default disabled mode led to silently incorrect builds.

The automake manual admits that being able to disable maintainer
mode still makes sense for projects that still store generated
files from the autotools in version control; but we have dropped
that for several years now.  As such, it's finally time to just
ditch the whole idea of maintainer mode, and unconditionally
rebuild autotools files if a dependency changes, without offering
a configure option to disable that mode.

* configure.ac (AM_MAINTAINER_MODE): Drop.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoRemove use of virConnectPtr from all remaining nwfilter code
Daniel P. Berrange [Thu, 3 Oct 2013 11:51:48 +0000 (12:51 +0100)]
Remove use of virConnectPtr from all remaining nwfilter code

The virConnectPtr is passed around loads of nwfilter code in
order to provide it as a parameter to the callback registered
by the virt drivers. None of the virt drivers use this param
though, so it serves no purpose.

Avoiding the need to pass a virConnectPtr means that the
nwfilterStateReload method no longer needs to open a bogus
QEMU driver connection. This addresses a race condition that
can lead to a crash on startup.

The nwfilter driver starts before the QEMU driver and registers
some callbacks with DBus to detect firewalld reload. If the
firewalld reload happens while the QEMU driver is still starting
up though, the nwfilterStateReload method will open a connection
to the partially initialized QEMU driver and cause a crash.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't pass virConnectPtr in nwfilter 'struct domUpdateCBStruct'
Daniel P. Berrange [Thu, 3 Oct 2013 11:45:26 +0000 (12:45 +0100)]
Don't pass virConnectPtr in nwfilter 'struct domUpdateCBStruct'

The nwfilter driver only needs a reference to its private
state object, not a full virConnectPtr. Update the domUpdateCBStruct
struct to have a 'void *opaque' field instead of a virConnectPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove virConnectPtr arg from virNWFilterDefParse*
Daniel P. Berrange [Thu, 3 Oct 2013 11:35:34 +0000 (12:35 +0100)]
Remove virConnectPtr arg from virNWFilterDefParse*

None of the virNWFilterDefParse* methods require a virConnectPtr
arg, so just drop it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdjust legacy max payload size to account for header information
Claudio Bley [Mon, 7 Oct 2013 10:13:00 +0000 (12:13 +0200)]
Adjust legacy max payload size to account for header information

Commit 27e81517a87 set the payload size to 256 KB, which is
actually the max packet size, including the size of the header.

Reduce this by VIR_NET_MESSAGE_HEADER_MAX (24) and set
VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX to 262120, which was the original
value before increasing the limit in commit eb635de1fed.

11 years agonodeinfo: make freebsdNodeGetCPUCount work on Mac OS X
Ryota Ozaki [Sat, 5 Oct 2013 05:56:37 +0000 (14:56 +0900)]
nodeinfo: make freebsdNodeGetCPUCount work on Mac OS X

This fixes the following error:
  error : nodeGetInfo:933 : this function is not supported
  by the connection driver: node info not implemented on this platform

The freebsdNodeGetCPUCount was renamed to appleFreebsdNodeGetCPUCount
in order to make more visible the fact, that it works on Mac OS X too.

Mac OS X can use sysctlbyname as same as FreeBSD to get the CPU
frequency. However, the MIB style name is different from FreeBSD's.
And the unit of the return frequency is also different.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agorpc: fix getsockopt for LOCAL_PEERCRED on Mac OS X
Ryota Ozaki [Sat, 5 Oct 2013 05:56:36 +0000 (14:56 +0900)]
rpc: fix getsockopt for LOCAL_PEERCRED on Mac OS X

This fixes the following error:
  error : virGetUserEnt:703 : Failed to find user record for uid '32654'

'32654' (it's random and varies) comes from getsockopt with
LOCAL_PEERCRED option. getsockopt returns w/o error but seems
to not set any value to the buffer for uid.

For Mac OS X, LOCAL_PEERCRED has to be used with SOL_LOCAL level.
With SOL_LOCAL, getsockopt returns a correct uid.

Note that SOL_LOCAL can be found in
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/un.h.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agodoc: fix typo in HACKING
Chen Hanxiao [Mon, 7 Oct 2013 04:51:13 +0000 (12:51 +0800)]
doc: fix typo in HACKING

s/installion/installation

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agobuild: fix build on 32-bit platforms
Eric Blake [Fri, 4 Oct 2013 23:46:43 +0000 (17:46 -0600)]
build: fix build on 32-bit platforms

qemumonitorjsontest.c: In function 'testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo':
qemumonitorjsontest.c:1134: warning: integer constant is too large for 'long' type

* tests/qemumonitorjsontest.c
(testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo)
(testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo): Use correct
type.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build on RHEL 5
Eric Blake [Fri, 4 Oct 2013 23:25:13 +0000 (17:25 -0600)]
build: fix build on RHEL 5

On RHEL 5, compilation fails with:

storage/storage_backend.c: In function 'createRawFile':
storage/storage_backend.c:339: warning: implicit declaration of function 'fallocate'
storage/storage_backend.c:339: warning: nested extern declaration of 'fallocate' [-Wnested-externs]

But:

$ grep HAVE_FALLOCATE config.h
/* #undef HAVE_FALLOCATE */

Huh? It turns out that in kernels that old, fallocate() is not
implemented (config.h is correct), but <linux/fs.h> defines
HAVE_FALLOCATE as an empty witness macro for a completely
different purpose.  Since storage_backend.c is including
<linux/fs.h> on RHEL 5, we are hosed by the kernel definition.
Newer kernels no longer pollute the namespace, and it's fairly
easy to convert to an expression that works with both the old
kernel witness and the new-style config.h (undefined or 1).

Problem introduced in commit 532fef3.

* src/storage/storage_backend.c (createRawFile): Avoid namespace
pollution from kernel, by checking HAVE_FALLOCATE for a value.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build --without-remote
Eric Blake [Fri, 27 Sep 2013 23:09:20 +0000 (17:09 -0600)]
build: fix build --without-remote

I tried to test ./configure --without-lxc --without-remote.
First, the build failed with some odd errors, such as an
inability to build xen, or link failures for virNetTLSInit.
But when you think about it, once there is no remote code,
all of libvirtd is useless, any stateful driver that depends
on libvirtd is also not worth compiling, and any libraries
used only by RPC code are not needed.  So I patched
configure.ac to make for some saner defaults when an
explicit disable is attempted.  Similarly, since we have
migrated virnetdevbridge into generic code, the workaround
for Linux kernel stupidity must not depend on stateful
drivers being in use.

Then there's 'make check' that needs segregation.

Wow - quite a bit of cleanup to make --without-remote useful :)

* configure.ac: Let --without-remote toggle defaults on stateful
drivers and other libraries.  Pick up Linux kernel workarounds
even when qemu and lxc are not being compiled.
* tests/Makefile.am (test_programs): Factor out programs that
require remote.
* src/libvirt_private.syms (rpc/virnet*.h): Move...
* src/libvirt_remote.syms: ...into new file.
* src/Makefile.am (SYM_FILES): Ship new syms file.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodocs: aclpolkit: Fix a heading typo
Cole Robinson [Fri, 4 Oct 2013 17:38:57 +0000 (13:38 -0400)]
docs: aclpolkit: Fix a heading typo

11 years agostorage: fix file allocation behavior in file cloning
Oskari Saarenmaa [Mon, 30 Sep 2013 16:57:35 +0000 (19:57 +0300)]
storage: fix file allocation behavior in file cloning

Fixed the safezero call for allocating the rest of the file after cloning
an existing volume; it used to always use a zero offset, causing it to
only allocate the beginning of the file.

Also modified file creation to try to use fallocate(2) to pre-allocate
disk space before copying any data to make sure it fails early on if disk
is full and makes sure we can skip zero blocks when copying file contents.

If fallocate isn't available we will zero out the rest of the file after
cloning and only use sparse cloning if client requested a lower allocation
than the input volume's capacity.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agovirfile: safezero: fix buffer allocation max size
Oskari Saarenmaa [Fri, 4 Oct 2013 13:49:05 +0000 (16:49 +0300)]
virfile: safezero: fix buffer allocation max size

My previous commit 7dc1d4ab was supposed to change safezero to allocate
1 megabyte at maximum, but had the logic reversed and will allocate 1
megabyte at minimum (and a lot more at maximum.)

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agotest: Fix coverity warnings
Cole Robinson [Fri, 4 Oct 2013 12:48:39 +0000 (08:48 -0400)]
test: Fix coverity warnings

11 years agoqemu: Use maximum guest memory size when getting NUMA placement advice
Peter Krempa [Fri, 4 Oct 2013 09:11:31 +0000 (11:11 +0200)]
qemu: Use maximum guest memory size when getting NUMA placement advice

When starting the VM the guest balloon driver is not loaded at that
time. We need to ask numad for placement of the complete VM.

11 years agonodedev: Resolve Relax-NG validity error
John Ferlan [Thu, 3 Oct 2013 21:11:57 +0000 (17:11 -0400)]
nodedev: Resolve Relax-NG validity error

Commit id 'c4a4603de' added an output <path> to the nodedev xml, but
did not update the schema.

This resulted in the failure of the 'virt-xml-validate' on a file
generated by 'virsh nodedev-dumpxml pci_0000_00_00_0' (for example).

This was found/seen by running autotest on my host.

11 years agoFree cmd in virNetDevVethCreate
Gao feng [Fri, 4 Oct 2013 10:53:53 +0000 (18:53 +0800)]
Free cmd in virNetDevVethCreate

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoFree cmd in virNetDevVethDelete
Gao feng [Fri, 4 Oct 2013 10:53:52 +0000 (18:53 +0800)]
Free cmd in virNetDevVethDelete

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agovirfile: safezero: fall back to writing block by block if mmap fails
Oskari Saarenmaa [Wed, 2 Oct 2013 07:31:09 +0000 (10:31 +0300)]
virfile: safezero: fall back to writing block by block if mmap fails

mmap can fail on 32-bit systems if we're trying to zero out a lot of data.
Fall back to using block-by-block writing in that case.  While we could map
smaller blocks it's unlikely that this code is used a lot and its easier to
just fall back to one of the existing methods.

Also modified the block-by-block zeroing to not allocate a megabyte of
zeroes if we're writing less than that.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agotest: snapshot: Add REDEFINE support
Cole Robinson [Wed, 21 Aug 2013 20:54:17 +0000 (16:54 -0400)]
test: snapshot: Add REDEFINE support

11 years agoqemu: snapshot: Break out redefine preparation to shared function
Cole Robinson [Wed, 21 Aug 2013 20:39:02 +0000 (16:39 -0400)]
qemu: snapshot: Break out redefine preparation to shared function

11 years agotest: Implement snapshot create/delete/revert APIs
Cole Robinson [Wed, 7 Aug 2013 17:40:46 +0000 (13:40 -0400)]
test: Implement snapshot create/delete/revert APIs

Again stolen from qemu_driver.c, but dropping all the unneeded bits.
This aims to copy all the current qemu validation checks since that's
the most commonly used real driver, but some of the checks are
completely artificial in the test driver.

This only supports creation of internal snapshots for initial
simplicity.

11 years agotest: Allow specifying domainsnapshot XML
Cole Robinson [Wed, 7 Aug 2013 14:57:55 +0000 (10:57 -0400)]
test: Allow specifying domainsnapshot XML

The user can pass it as a <test:domainsnapshot> subelement of a <domain>.

11 years agoqemu: snapshots: Simplify REDEFINE flag check
Cole Robinson [Wed, 21 Aug 2013 20:10:37 +0000 (16:10 -0400)]
qemu: snapshots: Simplify REDEFINE flag check

Makes things more readable IMO

11 years agoqemu: check actual netdev type rather than config netdev type during init
Laine Stump [Thu, 3 Oct 2013 10:02:35 +0000 (13:02 +0300)]
qemu: check actual netdev type rather than config netdev type during init

This resolves:

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

Note that a similar problem was reported in:

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

but the fix only worked for <interface type='hostdev'>, *not* for
<interface type='network'> where the network itself was a pool of
hostdevs.

The symptom in both cases was this error message:

   internal error: Unable to determine device index for network device

In both cases the cause was lack of proper handling for netdevs
(<interface>) of type='hostdev' when scanning the netdev list looking
for alias names in qemuAssignDeviceNetAlias() - those that aren't
type='hostdev' have an alias of the form "net%d", while those that are
hostdev use "hostdev%d". This special handling was completely lacking
prior to the fix for Bug 827519 which was:

When searching for the highest alias index, libvirt looks at the alias
for each netdev and if it is type='hostdev' it ignores the entry. If
the type is not hostdev, then it expects the "net%d" form; if it
doesn't find that, it fails and logs the above error message.

That fix works except in the case of <interface type='network'> where
the network uses hostdev (i.e. the network is a pool of VFs to be
assigned to the guests via PCI passthrough). In this case, the check
for type='hostdev' would fail because it was done as:

     def->net[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV

(which compares what was written in the config) when it actually
should have been:

    virDomainNetGetActualType(def->net[i]) == VIR_DOMAIN_NET_TYPE_HOSTDEV

(which compares the type of netdev that was actually allocated from
the network at runtime).

Of course the latter wouldn't be of any use if the netdevs of
type='network' hadn't already acquired their actual network connection
yet, but manual examination of the code showed that this is never the
case.

While looking through qemu_command.c, two other places were found to
directly compare the net[i]->type field rather than getting actualType:

* qemuAssignDeviceAliases() - in this case, the incorrect comparison
  would cause us to create a "net%d" alias for a netdev with
  type='network' but actualType='hostdev'. This alias would be
  subsequently overwritten by the proper "hostdev%d" form, so
  everything would operate properly, but a string would be
  leaked. This patch also fixes this problem.

* qemuAssignDevicePCISlots() - would defer assigning a PCI address to
  a netdev if it was type='hostdev', but not for type='network +
  actualType='hostdev'. In this case, the actual device usually hasn't
  been acquired yet anyway, and even in the case that it has, there is
  no practical difference between assigning a PCI address while
  traversing the netdev list or while traversing the hostdev
  list. Because changing it would be an effective NOP (but potentially
  cause some unexpected regression), this usage was left unchanged.

11 years agoqemucapabilitiesdata: Add qemu-1.6.50 data
Michal Privoznik [Thu, 3 Oct 2013 11:27:45 +0000 (13:27 +0200)]
qemucapabilitiesdata: Add qemu-1.6.50 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.6.0 data
Michal Privoznik [Thu, 3 Oct 2013 13:02:02 +0000 (15:02 +0200)]
qemucapabilitiesdata: Add qemu-1.6.0 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.4.2 data
Michal Privoznik [Thu, 3 Oct 2013 12:00:57 +0000 (14:00 +0200)]
qemucapabilitiesdata: Add qemu-1.4.2 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.3.1 data
Michal Privoznik [Thu, 3 Oct 2013 12:16:32 +0000 (14:16 +0200)]
qemucapabilitiesdata: Add qemu-1.3.1 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.2.2 data
Michal Privoznik [Thu, 3 Oct 2013 12:30:26 +0000 (14:30 +0200)]
qemucapabilitiesdata: Add qemu-1.2.2 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemuMonitorTestFree: Join worker thread
Michal Privoznik [Wed, 2 Oct 2013 16:20:18 +0000 (18:20 +0200)]
qemuMonitorTestFree: Join worker thread

Join the worker thread no matter if it is running or zombie already.
With current implementation the thread is joined iff @running is true.
However, when worker executes the last line, @running is set to false.
Hence qemuMonitorTestFree() won't join it (and free resources) even
though we can clearly see worker has run (nobody else sets @running =
false).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONSystemPowerdown
Michal Privoznik [Tue, 1 Oct 2013 14:28:51 +0000 (16:28 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONSystemPowerdown

Right now, we are testing qemuMonitorSystemPowerdown instead of
qemuMonitorJSONSystemPowerdown. It makes no harm, as both functions have
the same header and the former is just a wrapper over the latter. But we
should be consistent as we're testing the JSON functions only in here.

11 years agoUse 'vnet' as prefix for veth devices
Daniel P. Berrange [Wed, 2 Oct 2013 11:24:54 +0000 (12:24 +0100)]
Use 'vnet' as prefix for veth devices

The XML parser reserves 'vnet' as a prefix for automatically
generated NIC device names. Switch the veth device creation
to use this prefix, so it does not have to worry about clashes
with user specified names in the XML.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRetry veth device creation on failure
Daniel P. Berrange [Wed, 2 Oct 2013 11:18:49 +0000 (12:18 +0100)]
Retry veth device creation on failure

The veth device creation code run in two steps, first it looks
for two free veth device names, then it runs ip link to create
the veth pair. There is an obvious race between finding free
names and creating them, when guests are started in parallel.

Rewrite the code to loop and re-try creation if it fails, to
deal with the race condition.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid deleting NULL veth device name
Daniel P. Berrange [Wed, 2 Oct 2013 10:26:59 +0000 (11:26 +0100)]
Avoid deleting NULL veth device name

If veth device allocation has a fatal error, the veths
array may contain NULL device names. Avoid calling the
virNetDevVethDelete function on such names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid reporting an error if veth device is already deleted
Daniel P. Berrange [Wed, 2 Oct 2013 10:16:14 +0000 (11:16 +0100)]
Avoid reporting an error if veth device is already deleted

The kernel automatically destroys veth devices when cleaning
up the container network namespace. During normal shutdown, it
is thus likely that the attempt to run 'ip link del vethN'
will fail. If it fails, check if the device exists, and avoid
reporting an error if it has gone. This switches to use the
virCommand APIs instead of virRun too.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't set netdev offline in container cleanup
Daniel P. Berrange [Wed, 2 Oct 2013 10:10:45 +0000 (11:10 +0100)]
Don't set netdev offline in container cleanup

During container cleanup there is a race where the kernel may
have destroyed the veth device before we try to set it offline.
This causes log error messages. Given that we're about to
delete the device entirely, setting it offline is pointless.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability
Michal Privoznik [Wed, 2 Oct 2013 17:03:53 +0000 (19:03 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability

And so do qemuMonitorJSONSetMigrationCapability.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetTargetArch
Michal Privoznik [Wed, 2 Oct 2013 16:55:42 +0000 (18:55 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetTargetArch

11 years agoqemumonitorjsontest: Test qemuMonitorJSONSetBlockIoThrottle
Michal Privoznik [Wed, 2 Oct 2013 16:46:42 +0000 (18:46 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONSetBlockIoThrottle

Also do qemuMonitorJSONGetBlockIoThrottle.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetPtyPaths
Michal Privoznik [Wed, 2 Oct 2013 15:11:30 +0000 (17:11 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetPtyPaths

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus
Michal Privoznik [Wed, 2 Oct 2013 14:52:36 +0000 (16:52 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationStatus
Michal Privoznik [Wed, 2 Oct 2013 14:43:35 +0000 (16:43 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationStatus

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationCacheSize
Michal Privoznik [Wed, 2 Oct 2013 14:01:46 +0000 (16:01 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCacheSize

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBlockStatsInfo
Michal Privoznik [Wed, 2 Oct 2013 13:08:02 +0000 (15:08 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBlockStatsInfo

While the reply can be reused test qemuMonitorJSONGetBlockExtent and
qemuMonitorJSONGetBlockExtent too.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBlockInfo
Michal Privoznik [Wed, 2 Oct 2013 12:39:10 +0000 (14:39 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBlockInfo

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBalloonInfo
Michal Privoznik [Wed, 2 Oct 2013 10:02:53 +0000 (12:02 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBalloonInfo

11 years agoqemuMonitorJSONSendKey: Avoid double free
Michal Privoznik [Wed, 2 Oct 2013 16:18:13 +0000 (18:18 +0200)]
qemuMonitorJSONSendKey: Avoid double free

After successful @cmd construction the memory where @keys points to is
part of @cmd. Avoid double freeing it.

11 years agoqemuMonitorJSONGetVirtType: Fix error message
Michal Privoznik [Wed, 2 Oct 2013 11:58:40 +0000 (13:58 +0200)]
qemuMonitorJSONGetVirtType: Fix error message

When querying for kvm, we try to find 'enabled' field. Hence the error
message should report we haven't found 'enabled' and not 'running'
(which is not even in the reply). Probably a typo or copy-paste error.

11 years agoqemu_hotplug: Allow QoS update in qemuDomainChangeNet
Michal Privoznik [Tue, 1 Oct 2013 13:04:48 +0000 (15:04 +0200)]
qemu_hotplug: Allow QoS update in qemuDomainChangeNet

The qemuDomainChangeNet() is called when 'virsh update-device' is
invoked on a NIC. Currently, we fail to update the QoS even though
we have routines for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirNetDevBandwidthEqual: Make it more robust
Michal Privoznik [Wed, 2 Oct 2013 07:18:02 +0000 (09:18 +0200)]
virNetDevBandwidthEqual: Make it more robust

So far the virNetDevBandwidthEqual() expected both ->in and ->out items
to be allocated for both @a and @b compared. This is not necessary true
for all our code. For instance, running 'update-device' twice over a NIC
with the very same XML results in SIGSEGV-ing in this function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotest: Implement readonly snapshot APIs
Cole Robinson [Tue, 6 Aug 2013 15:20:37 +0000 (11:20 -0400)]
test: Implement readonly snapshot APIs

This is just stolen from qemu_driver.c with tweaks to fit the
test driver.

11 years agotest: Wire up managed save APIs
Cole Robinson [Tue, 6 Aug 2013 23:33:25 +0000 (19:33 -0400)]
test: Wire up managed save APIs

Also add a <test:hasmanagedsave> element to set this data when starting
the connection.

11 years agotest: Allow specifying object transient state in driver XML
Cole Robinson [Tue, 6 Aug 2013 22:36:30 +0000 (18:36 -0400)]
test: Allow specifying object transient state in driver XML

Similar to the runstate commit, allow a boolean <test:transient/>
element for setting domain persistence at driver startup.

11 years agoqemu: cgroup: Fix crash if starting nographics guest
Cole Robinson [Tue, 1 Oct 2013 11:55:19 +0000 (07:55 -0400)]
qemu: cgroup: Fix crash if starting nographics guest

We can dereference graphics[0] even if guest has no graphics device
configured. I screwed this up in a216e6487255d3b65d97c7ec1fa5da63dbced902

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

11 years agoselinux: Only close the selabel_handle once
Ján Tomko [Tue, 1 Oct 2013 11:15:12 +0000 (13:15 +0200)]
selinux: Only close the selabel_handle once

On selinux driver initialization failure (missing/incorrectly
formatted contexts file), selabel_handle was closed twice.

Introduced by 6159710.

11 years agoFix handling of IPv6 listen addresses in cmdDomDisplay
Ján Tomko [Tue, 1 Oct 2013 09:16:30 +0000 (11:16 +0200)]
Fix handling of IPv6 listen addresses in cmdDomDisplay

Use virSocketAddrIsWildcard instead of STREQ to check for the ANY
address and put brackets around the address if it contains ':'.

11 years agoutil: recognize SMB/CIFS filesystems as shared
Laine Stump [Thu, 26 Sep 2013 09:40:17 +0000 (05:40 -0400)]
util: recognize SMB/CIFS filesystems as shared

This should resolve:

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

libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as
"shared", and thus eligible for exceptions to certain rules/actions
about chowning image files before handing them off to a guest. This
patch widens the definition of "shared filesystem" to include SMB and
CIFS filesystems (aka "Windows file sharing"); both of these use the
same protocol, but different drivers so there are different magic
numbers for each.

11 years agotests: Introduce qemucapabilitiestest
Michal Privoznik [Thu, 19 Sep 2013 11:44:41 +0000 (13:44 +0200)]
tests: Introduce qemucapabilitiestest

This test is there to ensure that our capabilities detection code isn't
broken somehow.

How to gather test data:

Firstly, the data is split into two separate files. The former (with
suffix .replies) contains all the qemu replies. This is very fragile as
introducing a new device can mean yet another monitor command and hence
edit of this file in the future. But there's no better way of doing
this. To get this data simply turn on debug logs and copy all the
QEMU_MONITOR_IO_PROCESS lines. But be careful to not copy incomplete
ones (yeah, we report some incomplete lines too). Long story short, at
the libvirtd startup, a dummy qemu is spawn to get all the capabilities.

The latter (with suffix .caps) contains capabilities XML. Just start a
domain and copy the corresponding part from its state XML file.
Including <qemuCaps> tag.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemuMonitorTest: Make check for monitor command match optional
Michal Privoznik [Thu, 19 Sep 2013 13:19:08 +0000 (15:19 +0200)]
qemuMonitorTest: Make check for monitor command match optional

In a few cases we might want to not care if monitor command executed on
the mocked monitor matches the one we have reply for. Sounds crazy, but
if we just want monitor to return certain values (e.g. read from a file)
there is no need to care about command match.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotests: Learn qemuMonitorTestNew optional greeting
Michal Privoznik [Thu, 19 Sep 2013 11:56:30 +0000 (13:56 +0200)]
tests: Learn qemuMonitorTestNew optional greeting

Currently, when creating a new mocked monitor, the greeting can't be
chosen. This is crucial for next patches, because some info as qemu
version is obtained in the greeting message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu_capabilities: Introduce virQEMUCapsInitQMPMonitor
Michal Privoznik [Thu, 19 Sep 2013 11:14:25 +0000 (13:14 +0200)]
qemu_capabilities: Introduce virQEMUCapsInitQMPMonitor

This basically covers the talking-to-monitor part of
virQEMUCapsInitQMP.  The patch itself has no real value,
but it creates an entity to be tested in the next patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoRelease of libvirt-1.1.3
Daniel Veillard [Tue, 1 Oct 2013 07:04:14 +0000 (15:04 +0800)]
Release of libvirt-1.1.3

- configure.ac docs/news.html.in libvirt.spec.in: update for release
- po/*.po*: updated localization and regenerated