]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
13 years agotests: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)] 
tests: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/tests/qemuxml2argvtest.c:47:
alloc_arg: Calling allocation function "virAlloc" on "ret".
/libvirt/src/util/memory.c:101:
alloc_fn: Storage is returned from allocation function "calloc".
/libvirt/src/util/memory.c:101:
var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/libvirt/tests/qemuxml2argvtest.c:54:
leaked_storage: Variable "ret" going out of scope leaks the storage it points to.

(cherry picked from commit a01e67217c5e0a3fcba260e44c15b0fa94b47782)

13 years agoqemu: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)] 
qemu: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/src/qemu/qemu_driver.c:6968:
alloc_fn: Calling allocation function "calloc".
/libvirt/src/qemu/qemu_driver.c:6968:
var_assign: Assigning: "nodeset" =  storage returned from "calloc(1UL, 1UL)".
/libvirt/src/qemu/qemu_driver.c:6977:
noescape: Variable "nodeset" is not freed or pointed-to in function "virTypedParameterAssign".
/libvirt/src/qemu/qemu_driver.c:6997:
leaked_storage: Variable "nodeset" going out of scope leaks the storage it points to.

(cherry picked from commit c0774482ff9d0689e13eab5bed1da69867dd1902)

13 years agovmx: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)] 
vmx: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/src/vmx/vmx.c:2431:
alloc_fn: Calling allocation function "calloc".
/libvirt/src/vmx/vmx.c:2431:
var_assign: Assigning: "networkName" =  storage returned from "calloc(1UL, 1UL)".
/libvirt/src/vmx/vmx.c:2495:
leaked_storage: Variable "networkName" going out of scope leaks the storage it points to.

(cherry picked from commit 409a637eb1dc99ac1b85d3876302f876cb38a536)

13 years agoCoverity: Fix resource leak in virnetlink.c
Osier Yang [Wed, 2 May 2012 14:51:38 +0000 (22:51 +0800)] 
Coverity: Fix resource leak in virnetlink.c
(cherry picked from commit fd2b41574e05510ddeffbf9acbf06584acb3c2b2)

13 years agoCoverity: Fix resource leak in nodeinfo.c
Osier Yang [Wed, 2 May 2012 15:18:03 +0000 (23:18 +0800)] 
Coverity: Fix resource leak in nodeinfo.c

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: alloc_fn: Calling allocation function "fopen".
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:638: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
(cherry picked from commit 739cfc31619e9ba8ee450e8762261285093f1f47)

13 years agoCoverity: Fix resource leak in test driver
Osier Yang [Wed, 2 May 2012 14:51:36 +0000 (22:51 +0800)] 
Coverity: Fix resource leak in test driver

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1041: alloc_arg: Calling allocation function "virXPathNodeSet" on "devs".
/builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:621: alloc_arg: "virAllocN" allocates memory that is stored into "*list".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(count, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:625: noescape: Variable "*list" is not freed or pointed-to in function "memcpy".
/builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1098: leaked_storage: Variable "devs" going out of scope leaks the storage it points to.
(cherry picked from commit ad4d4ad036c80806afbfa108fb2d47bb73497d31)

13 years agoCoverity: Fix resource leak in xen driver
Osier Yang [Wed, 2 May 2012 14:51:35 +0000 (22:51 +0800)] 
Coverity: Fix resource leak in xen driver

Coverity logs:

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: alloc_fn: Calling allocation function "xenDaemonLookupByUUID".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: alloc_fn: Storage is returned from allocation function "virGetDomain".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:191: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:210: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: var_assign: Assigning: "ret" = "virGetDomain(conn, name, uuid)".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2541: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: var_assign: Assigning: "dom" =  storage returned from "xenDaemonLookupByUUID(conn, rawuuid)".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:126: leaked_storage: Variable "dom" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: alloc_fn: Calling allocation function "fopen".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "cpuinfo" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:45: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "cpuinfo".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: alloc_fn: Calling allocation function "fopen".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: var_assign: Assigning: "capabilities" =  storage returned from "fopen("/sys/hypervisor/properties/capabilities", "r")".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "capabilities" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:60: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "capabilities".
/builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "capabilities" going out of scope leaks the storage it points to.
(cherry picked from commit e91e0ab6042879a170b22bb942cf4051f8900e46)

13 years agoCoverity: Fix resource leaks in phyp driver
Osier Yang [Fri, 4 May 2012 02:25:58 +0000 (10:25 +0800)] 
Coverity: Fix resource leaks in phyp driver

Coverity logs:

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: alloc_fn: Calling allocation function "fopen".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: var_assign: Assigning: "fd" =  storage returned from "fopen(local_file, "rb")".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:540: noescape: Variable "fd" is not freed or pointed-to in function "fread".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:542: noescape: Variable "fd" is not freed or pointed-to in function "feof".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:575: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:585: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: alloc_fn: Calling allocation function "phypVolumeLookupByName".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: alloc_fn: Storage is returned from allocation function "virGetStorageVol".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:724: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:753: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: var_assign: Assigning: "vol" = "virGetStorageVol(pool->conn, pool->name, volname, key)".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2030: return_alloc: Returning allocated memory "vol".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: leaked_storage: Failing to save storage allocated by "phypVolumeLookupByName(pool, voldef->name)" leaks it.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: alloc_fn: Calling allocation function "phypGetStoragePoolLookUpByUUID".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: var_assign: Assigning: "sp" = "virGetStoragePool(conn, pools[i], uuid)".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2694: return_alloc: Returning allocated memory "sp".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: leaked_storage: Failing to save storage allocated by "phypGetStoragePoolLookUpByUUID(conn, def->uuid)" leaks it.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: leaked_storage: Failing to save storage allocated by "phypStoragePoolLookupByName(conn, def->name)" leaks it.

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: var_assign: Assigning: "sp" =  storage returned from "phypStoragePoolLookupByName(vol->conn, vol->pool)".
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2324: leaked_storage: Variable "sp" going out of scope leaks the storage it points to.
/builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2327: leaked_storage: Variable "sp" going out of scope leaks the storage it points t
(cherry picked from commit cff0d342adbbb955664c781b6c51bfd9b9d738b8)

13 years agoCoverity: Fix the forward_null error in Python binding codes
Osier Yang [Wed, 2 May 2012 15:05:59 +0000 (23:05 +0800)] 
Coverity: Fix the forward_null error in Python binding codes

Related coverity log:

Error: FORWARD_NULL:
/builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355:
assign_zero: Assigning: "params" = 0.
/builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458:
var_deref_model: Passing null variable "params" to function
"getPyVirTypedParameter", which dereferences it. (The dereference is assumed on
the basis of the 'nonnull' parameter attribute.)
(cherry picked from commit b80f4db9931ceea4bec1d178322058df77ece7a4)

13 years agobuild: fix build on cygwin
Eric Blake [Thu, 3 May 2012 20:39:19 +0000 (14:39 -0600)] 
build: fix build on cygwin

On cygwin, <rpc/rpc.h> lives in a different directory than
/usr/include, so anything that uses it must modify CFLAGS.  This
previously tripped up just 'make check', but now that we build
all test programs unconditionally, it also trips up 'make'.

* tests/Makefile.am (virnetmessagetest_CFLAGS): Find rpc headers.
(cherry picked from commit c898263826794ffded3301baafcf15d268657021)

13 years agoCorrect indent errors in the function qemuDomainNetsRestart
Li Zhang [Thu, 3 May 2012 05:52:44 +0000 (13:52 +0800)] 
Correct indent errors in the function qemuDomainNetsRestart

qemuDomainNetsRestart indents with 3 spaces.

This patch is to correct it.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
(cherry picked from commit 0d631e91823529a7ca7631a7f708a4fdbc9ed51e)

13 years agobuild: update pid_t type static check
Marc-André Lureau [Fri, 20 Apr 2012 13:13:52 +0000 (15:13 +0200)] 
build: update pid_t type static check

The code uses long long for pid_t now.
It fails on mingw64 without this change.
(cherry picked from commit d08c28f65faf85804fe7a7295a1694bdb0d225c3)

13 years agobuild: fix output of pid values
Marc-André Lureau [Fri, 20 Apr 2012 13:13:51 +0000 (15:13 +0200)] 
build: fix output of pid values

Fix a few more places where pid_t is printed with wrong type
(cherry picked from commit ca1bf4bd7433f05862a6c46d7da4dacaa6a89e2b)

13 years agovirsh: make -h always give help
Eric Blake [Mon, 30 Apr 2012 20:19:11 +0000 (14:19 -0600)] 
virsh: make -h always give help

https://bugzilla.redhat.com/show_bug.cgi?id=817244 mentions that
unlike most other tools, where --help or --version prevent all
further parsing of all later options, virsh was strange in that
--version stopped parsing but --help tried to plow on to the end.
There was no rationale for this original implementation (since
2005!), so I think we can safely conform to common usage patterns.

* tools/virsh.c (main): Drop useless 'help' variable.
(cherry picked from commit 46e5d36b8998c53fbea9c589f618ae906103fec7)

13 years agobuild: make ATTRIBUTE_NONNULL() a NOP unless STATIC_ANALYSIS is on
Laine Stump [Wed, 25 Apr 2012 20:10:01 +0000 (16:10 -0400)] 
build: make ATTRIBUTE_NONNULL() a NOP unless STATIC_ANALYSIS is on

The ATTRIBUTE_NONNULL(m) macro normally resolves to the gcc builtin
__attribute__((__nonnull__(m))). The effect of this in gcc is
unfortunately only to make gcc believe that "m" can never possibly be
NULL, *not* to add in any checks to guarantee that it isn't ever NULL
(i.e. it is an optimization aid, *not* something to verify code
correctness.) - see the following gcc bug report for more details:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308

Static source analyzers such as clang and coverity apparently can use
ATTRIBUTE_NONNULL(), though, to detect dead code (in the case that the
arg really is guaranteed non-NULL), as well as situations where an
obviously NULL arg is given to the function.

https://bugzilla.redhat.com/show_bug.cgi?id=815270 is a good example
of a bug caused by erroneous application of ATTRIBUTE_NONNULL().
Several people spent a long time staring at this code and not finding
the problem, because the problem wasn't in the function itself, but in
the prototype that specified ATTRIBUTE_NONNULL() for an arg that
actually *wasn't* always non-NULL, and caused a segv when dereferenced
(even though the code that dereferenced the pointer was inside an if()
that checked for a NULL pointer, that code was optimized out by gcc).

There may be some very small gain to be had from the optimizations
that can be inferred from ATTRIBUTE_NONNULL(), but it seems safer to
err on the side of generating code that behaves as expected, while
turning on the attribute for static analyzers.
(cherry picked from commit eefb881d4683d50882b43e5b28b0e94657cd0c9c)

13 years agoMake lxcContainerSetStdio the last thing to be called in container startup
Daniel P. Berrange [Tue, 1 May 2012 09:48:52 +0000 (10:48 +0100)] 
Make lxcContainerSetStdio the last thing to be called in container startup

Once lxcContainerSetStdio is invoked, logging will not work as
expected in libvirt_lxc. So make sure this is the last thing to
be called, in particular after setting the security process label
(cherry picked from commit 07cf96ecc7b0933c67febb1c5bd50fc0bbeba263)

13 years agoEnsure logging is initialized early in libvirt_lxc
Daniel P. Berrange [Tue, 1 May 2012 09:47:53 +0000 (10:47 +0100)] 
Ensure logging is initialized early in libvirt_lxc

The virLogSetFromEnv call was done too late in startup to
catch many log messages (eg from security driver initialization).
To assist debugging also explicitly log the security details
at startup
(cherry picked from commit 43ee98731256673b903d7ddf996eec7b4f72b99d)

13 years agoEnsure LXC security driver is set unconditonally
Daniel P. Berrange [Tue, 1 May 2012 09:46:08 +0000 (10:46 +0100)] 
Ensure LXC security driver is set unconditonally

The driver->securityDriverName field may be NULL, if automatic
probing is used to determine security driver. This meant that
unless selinux was explicitly requested in lxc.conf, it was
not being sent to the libvirt_lxc process.

The driver->securityManager field is guaranteed non-NULL, since
there will always be the 'none' security driver present if
nothing else exists. So use that to set the driver name for
libvirt_lxc

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 3746b070e79e5fe573f8b0bf32095a34f91b1eba)

13 years agoEnsure libvirt_lxc process loads the live XML config
Daniel P. Berrange [Mon, 30 Apr 2012 14:48:57 +0000 (15:48 +0100)] 
Ensure libvirt_lxc process loads the live XML config

Currently the libvirt_lxc process uses VIR_DOMAIN_XML_INACTIVE
when loading the XML for the container. This means it loses
any dynamic data such as the, just allocated, SELinux label.

Further there is an inconsistency in the libvirt LXC driver
whereby it saves the live config XML and then later overwrites
the file with the live status XML instead. Add a comment about
this for future reference.

* src/lxc/lxc_controller.c: Remove VIR_DOMAIN_XML_INACTIVE
  when loading XML
* src/lxc/lxc_driver.c: Add comment about inconsistent
  config file formats

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit eb06375a84c841b769ba4ca89f060ea72a66f1f8)

13 years agomaint: avoid false positives on unmarked diagnostics
Eric Blake [Mon, 30 Apr 2012 21:55:13 +0000 (15:55 -0600)] 
maint: avoid false positives on unmarked diagnostics

Otherwise, a string such as _("Don't use \"" VAR "\".") would
complain about unmarked diagnostics.

* cfg.mk (sc_libvirt_unmarked_diagnostics): Handle \" in message.
(cherry picked from commit 8f3728f85366d99568134053c959ba32ffb0e662)

13 years agoqemu: allow snapshotting of sheepdog and rbd disks
Josh Durgin [Tue, 1 May 2012 05:55:22 +0000 (22:55 -0700)] 
qemu: allow snapshotting of sheepdog and rbd disks

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
(cherry picked from commit b57e01532a1691897e27f20eccfd667a46ee374e)

13 years agoqemu: change rbd auth_supported separation character to ;
Josh Durgin [Tue, 1 May 2012 05:56:08 +0000 (22:56 -0700)] 
qemu: change rbd auth_supported separation character to ;

This works with newer qemu that doesn't allow escaping spaces.
It's backwards compatible as well.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
(cherry picked from commit d50cae33356f9ac220a5e84e9218c13806c0b246)

13 years agoutil: Avoid libvirtd crash in virNetDevTapCreate
Alex Jia [Sat, 28 Apr 2012 11:01:40 +0000 (19:01 +0800)] 
util: Avoid libvirtd crash in virNetDevTapCreate

In fact, the 'tapfd' is always NULL, the function 'virNetDevTapCreate()' hasn't
assign 'fd' to 'tapfd', when the function 'virNetDevSetMAC()' is failed then
goto 'error' label, finally, the VIR_FORCE_CLOSE() will deref a NULL 'tapfd'.

* util/virnetdevtap.c (virNetDevTapCreateInBridgePort): fix a NULL pointer derefing.

* How to reproduce?

$ cat > /tmp/net.xml <<EOF
<network>
  <name>test</name>
  <forward mode='nat'/>
  <bridge name='br1' stp='off' delay='1' />
  <mac address='00:00:00:00:00:00'/>
  <ip address='192.168.100.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.100.2' end='192.168.100.254' />
    </dhcp>
  </ip>
</network>
EOF

$ virsh net-define /tmp/net.xml

$ virsh net-start test
error: Failed to start network brTest
error: End of file while reading data: Input/output error

Signed-off-by: Alex Jia <ajia@redhat.com>
(cherry picked from commit 5ee18aaa578768893918d67e0dc36fe72b73b736)

13 years agostorage: Break out the loop if duplicate pool is found
Osier Yang [Sat, 28 Apr 2012 08:18:44 +0000 (16:18 +0800)] 
storage: Break out the loop if duplicate pool is found

It doesn't break out the "for" loop even if duplicate pool is
found, and thus the "matchpool" could be overriden as NULL again
if there is different pool afterwards.

To address the problem in libvirt-user list:

https://www.redhat.com/archives/libvirt-users/2012-April/msg00150.html
(cherry picked from commit 980f12be7221b07e569fed24b372ea00c52d9511)

13 years agoqemu: Make sure qemu can access its directory in hugetlbfs
Jiri Denemark [Fri, 27 Apr 2012 13:50:22 +0000 (15:50 +0200)] 
qemu: Make sure qemu can access its directory in hugetlbfs

When libvirtd is started, we create "libvirt/qemu" directories under
hugetlbfs mount point. Only the "qemu" subdirectory is chowned to qemu
user and "libvirt" remains owned by root. If umask was too restrictive
when libvirtd started, qemu user may lose access to "qemu"
subdirectory. Let's explicitly grant search permissions to "libvirt"
directory for all users.
(cherry picked from commit 9d2ac5453e4d50c6f12b2f8a5078691fec60020b)

13 years agoqemu_agent: Report error class at least
Michal Privoznik [Thu, 12 Apr 2012 14:35:24 +0000 (16:35 +0200)] 
qemu_agent: Report error class at least

Currently, qemu GA is not providing 'desc' field for errors like
we are used to from qemu monitor. Therefore, we fall back to this
general 'unknown error' string. However, GA is reporting 'class' which
is not perfect, but much more helpful than generic error string.
Thus we should fall back to class firstly and if even no class
is presented, then we can fall back to that generic string.

Before this patch:
virsh # dompmsuspend --target mem f16
error: Domain f16 could not be suspended
error: internal error unable to execute QEMU command
'guest-suspend-ram': unknown QEMU command error

After this patch:
virsh # dompmsuspend --target mem f16
error: Domain f16 could not be suspended
error: internal error unable to execute QEMU command
'guest-suspend-ram': The command has not been found
(cherry picked from commit 378031088fc95e576e517702f0ce2aa1fb30d8c3)

13 years agoMore coverity findings addressed
Stefan Berger [Fri, 27 Apr 2012 21:25:35 +0000 (17:25 -0400)] 
More coverity findings addressed

More bug extermination in the category of:

Error: CHECKED_RETURN:

/libvirt/src/conf/network_conf.c:595:
check_return: Calling function "virAsprintf" without checking return value (as is done elsewhere 515 out of 543 times).

/libvirt/src/qemu/qemu_process.c:2780:
unchecked_value: No check of the return value of "virAsprintf(&msg, "was paused (%s)", virDomainPausedReasonTypeToString(reason))".

/libvirt/tests/commandtest.c:809:
check_return: Calling function "setsid" without checking return value (as is done elsewhere 4 out of 5 times).

/libvirt/tests/commandtest.c:830:
unchecked_value: No check of the return value of "virTestGetDebug()".

/libvirt/tests/commandtest.c:831:
check_return: Calling function "virTestGetVerbose" without checking return value (as is done elsewhere 41 out of 42 times).

/libvirt/tests/commandtest.c:833:
check_return: Calling function "virInitialize" without checking return value (as is done elsewhere 18 out of 21 times).

One note about the error in commandtest line 809: setsid() seems to fail when running the test -- could be removed ?

(cherry picked from commit 59b935f5ae92e0833e71cc3b490cf1e24eee43fb)

13 years agolxc: Fix coverity findings
Stefan Berger [Fri, 27 Apr 2012 18:39:17 +0000 (14:39 -0400)] 
lxc: Fix coverity findings

Error: UNINIT:
/libvirt/src/lxc/lxc_driver.c:1412:
var_decl: Declaring variable "fd" without initializer.
/libvirt/src/lxc/lxc_driver.c:1460:
uninit_use_in_call: Using uninitialized value "fd" when calling "virFileClose".
/libvirt/src/util/virfile.c:50:
read_parm: Reading a parameter value.

Error: DEADCODE:
/libvirt/src/lxc/lxc_controller.c:960:
dead_error_condition: On this path, the condition "ret == 4" cannot be true.
/libvirt/src/lxc/lxc_controller.c:959:
at_most: After this line, the value of "ret" is at most -1.
/libvirt/src/lxc/lxc_controller.c:959:
new_values: Noticing condition "ret < 0".
/libvirt/src/lxc/lxc_controller.c:961:
dead_error_line: Execution cannot reach this statement "continue;".

Error: UNINIT:
/libvirt/src/lxc/lxc_controller.c:1104:
var_decl: Declaring variable "consoles" without initializer.
/libvirt/src/lxc/lxc_controller.c:1237:
uninit_use: Using uninitialized value "consoles".

(cherry picked from commit f74471de4fe03eb79d670dc5c6e1191ba15b0766)

13 years agobuild: fix stamp file name
Eric Blake [Fri, 11 May 2012 14:20:34 +0000 (08:20 -0600)] 
build: fix stamp file name

Ever since commit c964b6a, make was trying to find the timestamp
of '""./apibuild.py".stamp"', but only touching 'apibuild.py.stamp',
and thus always rebuilding.  Reported by Daniel P. Berrange.

* docs/Makefile.am (APIBUILD, APIBUILD_STAMP): Omit bogus quotes.
(cherry picked from commit c0057d9a49f6aead9a893c33069d2a11c03bc1e8)

13 years agoRevert "building: remove libvirt_dbus.syms from EXTRA_DIST"
Eric Blake [Wed, 16 May 2012 21:41:27 +0000 (15:41 -0600)] 
Revert "building: remove libvirt_dbus.syms from EXTRA_DIST"

This reverts commit 372a14c67365660cf03260bfcacd01e9ce600ebb.

We shoul not have cherry-picked 28ae4ff0 without also cherry-picking
2223ea98, but the latter is too complex for a stable branch.

13 years agoStable release 0.9.11.3 v0.9.11.3
Cole Robinson [Fri, 27 Apr 2012 18:58:18 +0000 (14:58 -0400)] 
Stable release 0.9.11.3

13 years agopython: Fix doc directory name for stable releases
Cole Robinson [Fri, 27 Apr 2012 16:06:34 +0000 (12:06 -0400)] 
python: Fix doc directory name for stable releases

We were using the libvirt release version (like 0.9.11) and not
the configure version (which for stable releases is 0.9.11.X)

Most other places got this right so hopefully that's all the fallout
from the version format change :)

Signed-off-by: Cole Robinson <crobinso@redhat.com>
13 years agodocs: Serialize running apibuild.py
Cole Robinson [Fri, 27 Apr 2012 16:05:12 +0000 (12:05 -0400)] 
docs: Serialize running apibuild.py

Use a witness file approach like we do for python/generator.py,
as suggested by Eric. Fixes the build issue reported here:

https://www.redhat.com/archives/libvir-list/2012-April/msg01435.html

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Conflicts:

.gitignore

13 years agoconfigure: Use ustar format for dist tarball
Cole Robinson [Fri, 27 Apr 2012 16:03:44 +0000 (12:03 -0400)] 
configure: Use ustar format for dist tarball

Since for stable releases, some test files were over the 99 char
limit for traditional tar filenames.

Suggested by Osier here:
https://www.redhat.com/archives/libvir-list/2012-April/msg01435.html

Signed-off-by: Cole Robinson <crobinso@redhat.com>
13 years agoqemu: improve errors related to offline domains
Eric Blake [Thu, 26 Apr 2012 19:36:01 +0000 (13:36 -0600)] 
qemu: improve errors related to offline domains

https://bugzilla.redhat.com/show_bug.cgi?id=816662 pointed out
that attempting 'virsh blockpull' on an offline domain gave a
misleading error message about qemu lacking support for the
operation, even when qemu was specifically updated to support it.
The real problem is that we have several capabilities that are
only determined when starting a domain, and therefore are still
clear when first working with an inactive domain (namely, any
capability set by qemuMonitorJSONCheckCommands).

While this patch was able to hoist an existing check in one of the
three culprits, it had to add redundant checks in the other two
places (because you always have to check for an active domain after
obtaining a VM job lock, but the capability bits were being checked
prior to obtaining the job lock).

Someday it would be nice to patch libvirt to cache the set of
capabilities per qemu binary (as determined by inode and timestamp),
rather than re-probing the binary every time a domain is started,
and to teach the cache how to query the monitor during the one
time the probe is made rather than having to wait until a guest
is started; then, a capability probe would succeed even for offline
guests because it just refers to the cache, and the single check for
an active domain after grabbing the job lock would be sufficient.
But since that will involve a lot more coding, I'm happy to go
with this simpler solution for an immediate solution.

* src/qemu/qemu_driver.c (qemuDomainPMSuspendForDuration)
(qemuDomainSnapshotCreateXML, qemuDomainBlockJobImpl): Check for
offline state before checking an online-only cap.

Conflicts:

src/qemu/qemu_driver.c

13 years agonwfilter: address more coverity findings
Stefan Berger [Thu, 26 Apr 2012 20:45:36 +0000 (16:45 -0400)] 
nwfilter: address more coverity findings

This patch addresses the following coverity findings:

/libvirt/src/conf/nwfilter_params.c:390:
var_assigned: Assigning: "varValue" = null return value from "virHashLookup".

/libvirt/src/conf/nwfilter_params.c:392:
dereference: Dereferencing a pointer that might be null "varValue" when calling "virNWFilterVarValueGetNthValue".

/libvirt/src/conf/nwfilter_params.c:399:
dereference: Dereferencing a pointer that might be null "tmp" when calling "virNWFilterVarValueGetNthValue".

13 years agonwfilter: address coverity findings
Stefan Berger [Thu, 26 Apr 2012 20:45:36 +0000 (16:45 -0400)] 
nwfilter: address coverity findings

This patch addresses the following coverity findings:

/libvirt/src/conf/nwfilter_params.c:157:
deref_parm: Directly dereferencing parameter "val".

/libvirt/src/conf/nwfilter_params.c:473:
negative_returns: Using variable "iterIndex" as an index to array "res->iter".

/libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:2891:
unchecked_value: No check of the return value of "virAsprintf(&protostr, "-d 01:80:c2:00:00:00 ")".

/libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:2894:
unchecked_value: No check of the return value of "virAsprintf(&protostr, "-p 0x%04x ", l3_protocols[protoidx].attr)".

/libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:3590:
var_deref_op: Dereferencing null variable "inst".

13 years agoutil: fix error messages in virNetlinkEventServiceStart
Laine Stump [Thu, 26 Apr 2012 18:35:26 +0000 (14:35 -0400)] 
util: fix error messages in virNetlinkEventServiceStart

Some of the error messages in this function should have been
virReportSystemError (since they have an errno they want to log), but
were mistakenly written as netlinkError, which expects a libvirt error
code instead. The result was that when one of the errors was
encountered, "No error message provided" would be printed instead of
something meaningful (see
https://bugzilla.redhat.com/show_bug.cgi?id=816465 for an example).

13 years agoStable release 0.9.11.2 (previous tarball was busted) v0.9.11.2
Cole Robinson [Thu, 26 Apr 2012 22:03:51 +0000 (18:03 -0400)] 
Stable release 0.9.11.2 (previous tarball was busted)

13 years agoRelease of 0.9.11.1 stable v0.9.11.1
Cole Robinson [Thu, 26 Apr 2012 18:49:12 +0000 (14:49 -0400)] 
Release of 0.9.11.1 stable

13 years agoqemu: Avoid bogus error at the end of tunnelled migration
Jiri Denemark [Mon, 23 Apr 2012 14:17:55 +0000 (16:17 +0200)] 
qemu: Avoid bogus error at the end of tunnelled migration

Once qemu monitor reports migration has completed, we just closed our
end of the pipe and let migration tunnel die. This generated bogus error
in case we did so before the thread saw EOF on the pipe and migration
was aborted even though it was in fact successful.

With this patch we first wake up the tunnel thread and once it has read
all data from the pipe and finished the stream we close the
filedescriptor.

A small additional bonus of this patch is that real errors reported
inside qemuMigrationIOFunc are not overwritten by virStreamAbort any
more.

13 years agoqemu: Fix detection of failed migration
Jiri Denemark [Fri, 20 Apr 2012 15:10:37 +0000 (17:10 +0200)] 
qemu: Fix detection of failed migration

When QEMU reported failed or canceled migration, we correctly detected
it but didn't really consider it as an error condition and migration
protocol just went on. Luckily, some of the subsequent steps eventually
failed end we reported an (unrelated and mostly random) error back to
the caller.

13 years agorpc: Discard non-blocking calls only when necessary
Jiri Denemark [Fri, 20 Apr 2012 14:12:26 +0000 (16:12 +0200)] 
rpc: Discard non-blocking calls only when necessary

Currently, non-blocking calls are either sent immediately or discarded
in case sending would block. This was implemented based on the
assumption that the non-blocking keepalive call is not needed as there
are other calls in the queue which would keep the connection alive.
However, if those calls are no-reply calls (such as those carrying
stream data), the remote party knows the connection is alive but since
we don't get any reply from it, we think the connection is dead.

This is most visible in tunnelled migration. If it happens to be longer
than keepalive timeout (30s by default), it may be unexpectedly aborted
because the connection is considered to be dead.

With this patch, we only discard non-blocking calls when the last call
with a thread is completed and thus there is no thread left to keep
sending the remaining non-blocking calls.

13 years agoqemu: Preserve original error during migration
Jiri Denemark [Fri, 20 Apr 2012 12:07:49 +0000 (14:07 +0200)] 
qemu: Preserve original error during migration

In some cases (spotted with broken connection during tunneled migration)
we were overwriting the original error with worse or even misleading
errors generated when we were cleaning up after failed migration.

13 years agoutil: fix crash when starting macvtap interfaces
Laine Stump [Wed, 25 Apr 2012 19:49:44 +0000 (15:49 -0400)] 
util: fix crash when starting macvtap interfaces

This patch resolves https://bugzilla.redhat.com/show_bug.cgi?id=815270

The function virNetDevMacVLanVPortProfileRegisterCallback() takes an
arg "virtPortProfile", and was checking it for non-NULL before using
it. However, the prototype for
virNetDevMacVLanPortProfileRegisterCallback had marked that arg with
ATTRIBUTE_NONNULL(). Contrary to what one may think,
ATTRIBUTE_NONNULL() does not provide any guarantee that an arg marked
as such really is always non-null; the only effect to the code
generated by gcc, is that gcc *assumes* it is non-NULL; this results
in, for example, the check for a non-NULL value being optimized out.

(Unfortunately, this code removal only occurs when optimization is
enabled, and I am in the habit of doing local builds with optimization
off to ease debugging, so the bug didn't show up in my earlier local
testing).

In general, virPortProfile might always be NULL, so it shouldn't be
marked as ATTRIBUTE_NONNULL. One other function prototype made this
same error, so this patch fixes it as well.

13 years agobuild: fix bootstrap on RHEL
Eric Blake [Wed, 25 Apr 2012 03:40:08 +0000 (21:40 -0600)] 
build: fix bootstrap on RHEL

Commit 8fe455fd364cd7462e02170084c45a58ee302cc3 tried to work around
a regression introduced in upstream gnulib that requires gettext 0.18
or newer on all projects using bootstrap, by making libvirt require
gettext 0.18.  But this fails on RHEL 6.2, which still ships gettext
0.17.  Revert that change, and instead, import the latest round of
gnulib updates that fix that problem properly.

If you have already built in the window where libvirt required 0.18,
be aware that incremental updates may run into problems: this is
because 'autopoint --force' will not downgrade m4/po.m4 back to an
older version, but it must be downgraded back to 0.17 levels to work
with this patch.  You may either manually remove that file then rerun
bootstrap, or it may prove easier to just clean up all non-git files
to start from a clean slate.

* bootstrap.conf: Revert minimum gettext back to 0.17.
* configure.ac: Likewise.
* .gnulib: Update to latest, for bootstrap fixes.
* bootstrap: Resync from gnulib.

13 years agofix memleak in linuxParseCPUmap
Hu Tao [Tue, 24 Apr 2012 08:55:06 +0000 (16:55 +0800)] 
fix memleak in linuxParseCPUmap

13 years agobuild: Fix version of gettext macros
Peter Krempa [Tue, 24 Apr 2012 09:35:09 +0000 (11:35 +0200)] 
build: Fix version of gettext macros

Commit c9cd419caba9effa11ca53e8696e5f6a4b424d60 added copying of the
makefile for translation files from gnulib. The makefile from gnulib is
of version 0.18 but the build configuration cretes macros from version
0.17 which breaks the build with message:

*** error: gettext infrastructure mismatch: using a Makefile.in.in from
gettext version 0.18 but the autoconf macros are from gettext version
0.17

13 years agovbox: Fix passing an empty IMedium* array to IMachine::Delete
Matthias Bolte [Sun, 22 Apr 2012 08:31:33 +0000 (10:31 +0200)] 
vbox: Fix passing an empty IMedium* array to IMachine::Delete

vboxArray is not castable to a COM item type. vboxArray is a
wrapper around the XPCOM and MSCOM specific array handling.

In this case we can avoid passing NULL as an empty array to
IMachine::Delete by passing a dummy IMedium* array with a single
NULL item.

13 years agobuilding: remove libvirt_dbus.syms from EXTRA_DIST
Wen Congyang [Fri, 20 Apr 2012 03:05:13 +0000 (11:05 +0800)] 
building: remove libvirt_dbus.syms from EXTRA_DIST

commit 2223ea98 removes src/libvirt_dbus.syms, but it forgets
to remove it from EXTRA_DIST. It will cause 'make dist' failed.

13 years agowin32: Properly handle TlsGetValue returning NULL
Matthias Bolte [Sat, 21 Apr 2012 17:03:08 +0000 (19:03 +0200)] 
win32: Properly handle TlsGetValue returning NULL

virThreadSelf tries to access the virThreadPtr stored in TLS for the
current thread via TlsGetValue. When virThreadSelf is called on a thread
that was not created via virThreadCreate (e.g. the main thread) then
TlsGetValue returns NULL as TlsAlloc initializes TLS slots to NULL.

virThreadSelf can be called on the main thread via this call chain from
virsh

vshDeinit
virEventAddTimeout
virEventPollAddTimeout
virEventPollInterruptLocked
virThreadIsSelf

triggering a segfault as virThreadSelf unconditionally dereferences the
return value of TlsGetValue.

Fix this by making virThreadSelf check the TLS slot value for NULL and
setting the given virThreadPtr accordingly.

Reported by Marcel Müller.

13 years agoesx: Fix segfault in esxConnectToHost
Ryan Woodsmall [Sat, 21 Apr 2012 12:13:02 +0000 (14:13 +0200)] 
esx: Fix segfault in esxConnectToHost

Caused by commit 4445e16bfa8056980ac643fabf17186f9e685925 that
made the code used the connection private data pointer before
it was initialized.

13 years agoopenvz: wire up getHostname
Guido Günther [Mon, 16 Apr 2012 08:50:33 +0000 (10:50 +0200)] 
openvz: wire up getHostname

13 years agovirnetserver: handle sigaction correctly
Eric Blake [Fri, 20 Apr 2012 03:41:27 +0000 (21:41 -0600)] 
virnetserver: handle sigaction correctly

POSIX says that sa_sigaction is only safe to use if sa_flags
includes SA_SIGINFO; conversely, sa_handler is only safe to
use when flags excludes that bit.  Gnulib doesn't guarantee
an implementation of SA_SIGINFO, but does guarantee that
if SA_SIGINFO is undefined, we can safely define it to 0 as
long as we don't dereference the 2nd or 3rd argument of
any handler otherwise registered via sa_sigaction.

Based on a report by Wen Congyang.

* src/rpc/virnetserver.c (SA_SIGINFO): Stub for mingw.
(virNetServerSignalHandler): Avoid bogus dereference.
(virNetServerFatalSignal, virNetServerNew): Set flags properly.
(virNetServerAddSignalHandler): Drop unneeded #ifdef.

13 years agoconf: tighten up XML integer parsing
Eric Blake [Wed, 18 Apr 2012 23:58:44 +0000 (17:58 -0600)] 
conf: tighten up XML integer parsing

https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that
even with my recent patched to allow <memory unit='G'>1</memory>,
people can still get away with trying <memory>1G</memory> and
silently get <memory unit='KiB'>1</memory> instead.  While
virt-xml-validate catches the error, our C parser did not.

Not to mention that it's always fun to fix bugs while reducing
lines of code.  :)

* src/conf/domain_conf.c (virDomainParseMemory): Check for parse error.
(virDomainDefParseXML): Avoid strtoll.
* src/conf/storage_conf.c (virStorageDefParsePerms): Likewise.
* src/util/xml.c (virXPathLongBase, virXPathULongBase)
(virXPathULongLong, virXPathLongLong): Likewise.

13 years agobuild: avoid type-punning in vbox
Eric Blake [Thu, 19 Apr 2012 23:19:32 +0000 (17:19 -0600)] 
build: avoid type-punning in vbox

Commit 78345c68 makes at least gcc 4.1.2 on RHEL 5 complain:

cc1: warnings being treated as errors
In file included from vbox/vbox_V4_0.c:13:
vbox/vbox_tmpl.c: In function 'vboxDomainUndefineFlags':
vbox/vbox_tmpl.c:5298: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

* src/vbox/vbox_tmpl.c (vboxDomainUndefineFlags): Use union to
avoid compiler warning.

13 years agobuild: fix fresh checkout on RHEL5
Eric Blake [Thu, 19 Apr 2012 23:04:00 +0000 (17:04 -0600)] 
build: fix fresh checkout on RHEL5

Building a fresh checkout on RHEL 5 has been broken since commit
29db7a00, due to a gnulib regression in the bootstrap script
(incremental builds from a checkout earlier than that point were
okay, though).

* .gnulib: Update to latest, for bootstrap fixes.
* bootstrap: Resync from gnulib.
* gnulib/local/top/maint.mk.diff: Drop patch that was added
upstream in the meantime.

13 years agoutil: only register callbacks for CREATE operations in virnetdevmacvlan.c
D. Herrendoerfer [Fri, 13 Apr 2012 12:41:16 +0000 (14:41 +0200)] 
util: only register callbacks for CREATE operations in virnetdevmacvlan.c

Currently upon a migration a callback is created when a 802.1qbg link
is set to PREASSOCIATE, this should not happen because this is a no-op
on most switches, and does not lead to an ASSOCIATE state.  This patch
only creates callbacks when CREATE or RESTORE is requested.  Migration
and libvirtd restart scenarios are already handled elsewhere.

Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
13 years agoFix a memory leak
Stefan Berger [Tue, 17 Apr 2012 19:13:33 +0000 (15:13 -0400)] 
Fix a memory leak

The below patch fixes the following memory leak.

==20624== 24 bytes in 2 blocks are definitely lost in loss record 532 of 1,867
==20624==    at 0x4A05E46: malloc (vg_replace_malloc.c:195)
==20624==    by 0x38EC27FC01: strdup (strdup.c:43)
==20624==    by 0x4EB6BA3: virDomainChrSourceDefCopy (domain_conf.c:1122)
==20624==    by 0x495D76: qemuProcessFindCharDevicePTYs (qemu_process.c:1497)
==20624==    by 0x498321: qemuProcessWaitForMonitor (qemu_process.c:1258)
==20624==    by 0x49B5F9: qemuProcessStart (qemu_process.c:3652)
==20624==    by 0x468B5C: qemuDomainObjStart (qemu_driver.c:4753)
==20624==    by 0x469171: qemuDomainStartWithFlags (qemu_driver.c:4810)
==20624==    by 0x4F21735: virDomainCreate (libvirt.c:8153)
==20624==    by 0x4302BF: remoteDispatchDomainCreateHelper (remote_dispatch.h:852)
==20624==    by 0x4F72C14: virNetServerProgramDispatch (virnetserverprogram.c:416)
==20624==    by 0x4F6D690: virNetServerHandleJob (virnetserver.c:164)
==20624==    by 0x4E8F43D: virThreadPoolWorker (threadpool.c:144)
==20624==    by 0x4E8EAB5: virThreadHelper (threads-pthread.c:161)
==20624==    by 0x38EC606CCA: start_thread (pthread_create.c:301)
==20624==    by 0x38EC2E0C2C: clone (clone.S:115)

13 years agovbox: avoid provoking assertions in VBoxSVC
Jean-Baptiste Rouault [Fri, 13 Apr 2012 13:04:14 +0000 (15:04 +0200)] 
vbox: avoid provoking assertions in VBoxSVC

Passing a NULL pointer to IMachine::delete virtualbox API
causes VBoxSVC to raise an assertion. This patch passes
an empty array instead.

13 years agoconf: Do not parse cpuset only if the placement is auto
Osier Yang [Tue, 17 Apr 2012 14:57:01 +0000 (22:57 +0800)] 
conf: Do not parse cpuset only if the placement is auto

So that a domain xml which doesn't have "placement" specified, but
"cpuset" is specified, could be parsed. And in this case, the
"placement" mode will be set as "static".

13 years agoDo not enforce source type of console[0]
Jan Kiszka [Tue, 13 Mar 2012 15:48:27 +0000 (16:48 +0100)] 
Do not enforce source type of console[0]

If console[0] is an alias for serial[0], do not enforce the former to
have a PTY source type. This breaks serial consoles on stdio and makes
no sense.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
13 years agoxen: do not use ioemu type for any emulated NIC
Stefan Bader [Fri, 13 Apr 2012 13:14:56 +0000 (15:14 +0200)] 
xen: do not use ioemu type for any emulated NIC

When using the xm/xend stack to manage instances there is a bug
that causes the emulated interfaces to be unusable when the vif
config contains type=ioemu.

The current code already has a special quirk to not use this
keyword if no specific model is given for the emulated NIC
(defaulting to rtl8139).
Essentially it works because regardless of the type argument,i
the Xen stack always creates emulated and paravirt interfaces and
lets the guest decide which one to use. So neither xl nor xm stack
actually require the type keyword for emulated NICs.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
13 years agodocs: fix 'omitted' typo in <cputune> doc
Christophe Fergeau [Mon, 16 Apr 2012 16:41:25 +0000 (18:41 +0200)] 
docs: fix 'omitted' typo in <cputune> doc

'omitted' was mispelt 'commited' twice. One of the sentences with
the typo was also missing an 'is' ('each VCPU *is* pinned to all...')
which I added in this commit while I was at it.

13 years agodocs: add missing </span> in <vcpu placement> doc
Christophe Fergeau [Mon, 16 Apr 2012 16:40:44 +0000 (18:40 +0200)] 
docs: add missing </span> in <vcpu placement> doc

13 years agodocs: fix path to openvz network configuration file
Guido Günther [Mon, 16 Apr 2012 14:18:29 +0000 (16:18 +0200)] 
docs: fix path to openvz network configuration file

It's vznet.conf not vznetctl.conf, see e.g.:

http://git.openvz.org/?p=vzctl;a=blob;f=bin/vznetcfg.in;h=e91f5c4a0744c1ea149e1b8c241b666052e10b12;hb=HEAD

13 years agostorage: lvm: use correct lv* command parameters
Cole Robinson [Fri, 13 Apr 2012 11:34:41 +0000 (07:34 -0400)] 
storage: lvm: use correct lv* command parameters

lvcreate want's the parent pool's name, not the pool path
lvchange and lvremove want lv specified as $vgname/$lvname

This largely worked before because these commands strip off a
starting /dev. But https://bugzilla.redhat.com/show_bug.cgi?id=714986
is from a user using a 'nested VG' that was having problems.

I couldn't find any info on nested LVM and the reporter never responded,
but I reproduced with XML that specified a valid source name, and
set target path to a symlink.

13 years agonumad: Ignore cpuset if placement is auto
Osier Yang [Wed, 11 Apr 2012 14:40:33 +0000 (22:40 +0800)] 
numad: Ignore cpuset if placement is auto

As explained in previous patch, numad will balance the affinity
dynamically, so reflecting the cpuset from numad at the first
time doesn't make much case, and may just could cause confusion.
(cherry picked from commit 8fb2164cfff35ce0b87f1d513a0f3ca5111d7880)

13 years agonumad: Convert node list to cpumap before setting affinity
Osier Yang [Mon, 16 Apr 2012 10:04:27 +0000 (18:04 +0800)] 
numad: Convert node list to cpumap before setting affinity

Instead of returning a CPUs list, numad returns NUMA node
list instead, this patch is to convert the node list to
cpumap before affinity setting. Otherwise, the domain
processes will be pinned only to CPU[$numa_cell_num],
which will cause significiant performance losses.

Also because numad will balance the affinity dynamically,
reflecting the cpuset from numad back doesn't make much
sense then, and it may just could produce confusion for
the users. Thus the better way is not to reflect it back
to XML. And in this case, it's better to ignore the cpuset
when parsing XML.

The codes to update the cpuset is removed in this patch
incidentally, and there will be a follow up patch to ignore
the manually specified "cpuset" if "placement" is "auto",
and document will be updated too.
(cherry picked from commit ccf80e36301d538505c5c053cf369a61d4671831)

13 years agoFix macvtap detection by also checking for IFLA_VF_MAX
Guido Günther [Sat, 14 Apr 2012 17:18:03 +0000 (19:18 +0200)] 
Fix macvtap detection by also checking for IFLA_VF_MAX

since this isn't available on older kernels such as Debian Squeeze's
2.6.32. This make --with-macvtap=check work as expected.
(cherry picked from commit a2996926e303e84436a89dc42fe65d32b5ab8eb5)

13 years agovirnetdev: Check for defined IFLA_VF_*
Philipp Hahn [Fri, 13 Apr 2012 13:43:58 +0000 (15:43 +0200)] 
virnetdev: Check for defined IFLA_VF_*

The linux-2.6.32 kernel header does not yet define IFLA_VF_MAX and others,
which breaks compiling a new libvirt on old systems like Debian Squeeze.

(I also have to add --without-macvtap --disable-werror --without-virtualport to
 ./configure to get it to compile.)

Signed-off-by: Philipp Hahn <hahn@univention.de>
(cherry picked from commit d7451bddc55eabbe2c7a9070312ab3920cb93200)

13 years agoconf: Avoid double assignment in virDomainDiskRemove
Michal Privoznik [Fri, 13 Apr 2012 09:19:29 +0000 (11:19 +0200)] 
conf: Avoid double assignment in virDomainDiskRemove

Although it should be harmless to do:
    disk = disk = def->disks[i]
some not-so-wise compilers may fool around.
Besides, such assignment is useless here.
(cherry picked from commit e14d6571c1185133d15161bb4b18ec9b11192358)

13 years agoqemu: Fix mem leak in qemuProcessInitCpuAffinity
Michal Privoznik [Fri, 13 Apr 2012 08:53:17 +0000 (10:53 +0200)] 
qemu: Fix mem leak in qemuProcessInitCpuAffinity

If placement mode is AUTO, on some return paths char *cpumap or
char *nodeset are leaked.
(cherry picked from commit 354e6d4ed0b71cc90084faea32c360ce86a85b42)

13 years agoxend_internal: Use domain/status for shutdown check
Stefan Bader [Thu, 12 Apr 2012 13:42:37 +0000 (15:42 +0200)] 
xend_internal: Use domain/status for shutdown check

On newer xend (v3.x and after) there is no state and domid reported
for inactive domains. When initially creating connections this is
handled in various places by assigning domain->id = -1.
But once an instance has been running, the id is set to the current
domain id. And it does not change when the instance is shut down.
So when querying the domain info, the hypervisor driver, which gets
asked first will indicate it cannot find information, then the
xend driver is asked and will set the status to NOSTATE because it
checks for the -1 domain id.
Checking domain/status for 0 seems to be more reliable for that.

One note: I am not sure whether the domain->id also should get set
back to -1 whenever any sub-driver thinks the instance is no longer
running.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=746007
BugLink: http://bugs.launchpad.net/bugs/929626
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
(cherry picked from commit 26e9ef476239e8cb79f819092c5aac4afdd47d0d)

13 years agoqemu,util: fix netlink callback registration for migration
D. Herrendoerfer [Thu, 29 Mar 2012 11:15:00 +0000 (13:15 +0200)] 
qemu,util: fix netlink callback registration for migration

This patch adds a netlink callback when migrating a VEPA enabled
virtual machine.  It fixes a Bug where a VM would not request a port
association when it was cleared by lldpad.

This patch requires the latest git version of lldpad to work.

Signed-off-by: D. Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
(cherry picked from commit 997366ca7d174524725d6f6dfa8b14d6d2838ef0)

13 years agoqemuOpenFile: Don't force chown on NFS
Michal Privoznik [Wed, 11 Apr 2012 09:13:40 +0000 (11:13 +0200)] 
qemuOpenFile: Don't force chown on NFS

If dynamic_ownership is off and we are creating a file on NFS
we force chown. This will fail as chown/chmod are not supported
on NFS. However, with no dynamic_ownership we are not required
to do any chown.
(cherry picked from commit b1256816ff34ca94675ef62eccfa66f2a7daa0fc)

13 years agodaemon: Plug memory leaks
Alex Jia [Thu, 12 Apr 2012 09:10:42 +0000 (17:10 +0800)] 
daemon: Plug memory leaks

* daemon/libvirtd-config.c (daemonConfigFree): fix memory leaks.

How to reproduce?

% make && make -C tests check TESTS=libvirtdconftest
% cd tests && valgrind -v --leak-check=full ./libvirtdconftest

actual result:

==11008== 185 bytes in 5 blocks are definitely lost in loss record 3 of 5
==11008==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==11008==    by 0x39CF07F6E1: strdup (strdup.c:43)
==11008==    by 0x406626: daemonConfigLoadOptions (libvirtd-config.c:438)
==11008==    by 0x406800: daemonConfigLoadData (libvirtd-config.c:492)
==11008==    by 0x403CCF: testCorrupt (libvirtdconftest.c:110)
==11008==    by 0x404FAD: virtTestRun (testutils.c:145)
==11008==    by 0x403A34: mymain (libvirtdconftest.c:219)
==11008==    by 0x404687: virtTestMain (testutils.c:700)
==11008==    by 0x39CF01ECDC: (below main) (libc-start.c:226)
==11008==
==11008== LEAK SUMMARY:
==11008==    definitely lost: 185 bytes in 5 blocks

Signed-off-by: Alex Jia <ajia@redhat.com>
(cherry picked from commit d0eaf4b124ba5b2016107586c75aa4b1a985b157)

Conflicts:

daemon/libvirtd-config.c

13 years agoqemu: Fix deadlock when qemuDomainOpenConsole cleans up a connection
Peter Krempa [Tue, 10 Apr 2012 09:56:21 +0000 (11:56 +0200)] 
qemu: Fix deadlock when qemuDomainOpenConsole cleans up a connection

The new safe console handling introduced a possibility to deadlock the
qemu driver when a new console connection forcibly disconnects a
previous console stream that belongs to an already closed connection.

The virStreamFree function calls subsequently a the virReleaseConnect
function that tries to lock the driver while discarding the connection,
but the driver was already locked in qemuDomainOpenConsole.

Backtrace of the deadlocked thread:
0  0x00007f66e5aa7f14 in __lll_lock_wait () from /lib64/libpthread.so.0
1  0x00007f66e5aa3411 in _L_lock_500 () from /lib64/libpthread.so.0
2  0x00007f66e5aa322a in pthread_mutex_lock () from/lib64/libpthread.so.0
3  0x0000000000462bbd in qemudClose ()
4  0x00007f66e6e178eb in virReleaseConnect () from/usr/lib64/libvirt.so.0
5  0x00007f66e6e19c8c in virUnrefStream () from /usr/lib64/libvirt.so.0
6  0x00007f66e6e3d1de in virStreamFree () from /usr/lib64/libvirt.so.0
7  0x00007f66e6e09a5d in virConsoleHashEntryFree () from/usr/lib64/libvirt.so.0
8  0x00007f66e6db7282 in virHashRemoveEntry () from/usr/lib64/libvirt.so.0
9  0x00007f66e6e09c4e in virConsoleOpen () from /usr/lib64/libvirt.so.0
10 0x00000000004526e9 in qemuDomainOpenConsole ()
11 0x00007f66e6e421f1 in virDomainOpenConsole () from/usr/lib64/libvirt.so.0
12 0x00000000004361e4 in remoteDispatchDomainOpenConsoleHelper ()
13 0x00007f66e6e80375 in virNetServerProgramDispatch () from/usr/lib64/libvirt.so.0
14 0x00007f66e6e7ae11 in virNetServerHandleJob () from/usr/lib64/libvirt.so.0
15 0x00007f66e6da897d in virThreadPoolWorker () from/usr/lib64/libvirt.so.0
16 0x00007f66e6da7ff6 in virThreadHelper () from/usr/lib64/libvirt.so.0
17 0x00007f66e5aa0c5c in start_thread () from /lib64/libpthread.so.0
18 0x00007f66e57e7fcd in clone () from /lib64/libc.so.6

* src/qemu/qemu_driver.c: qemuDomainOpenConsole()
        -- unlock the qemu driver right after acquiring the domain
        object
(cherry picked from commit 3d3de46a6772baabb6c203a7961a790af6e8d08c)

13 years agobuild: avoid s390 compiler warnings
Eric Blake [Tue, 10 Apr 2012 15:46:01 +0000 (09:46 -0600)] 
build: avoid s390 compiler warnings

I noticed these compiler warnings when building for the s390 architecture.

* src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
Mark unused variable.
* src/nodeinfo.c (linuxNodeInfoCPUPopulate): Avoid unused variable.
(cherry picked from commit 9011a494acf0abb8da8fb45dbfb2ac8d7f2a994d)

13 years agovirsh: Clarify use of the --managed-save flag for the list command
Peter Krempa [Tue, 10 Apr 2012 10:21:03 +0000 (12:21 +0200)] 
virsh: Clarify use of the --managed-save flag for the list command

The documentation for the flag doesn't clearly state that the flag only
enhances the output and the user needs to specify other flags to list
inactive domains, that are enhanced by this flag.
(cherry picked from commit cc5100654b2aff0933ab4aa447a71bfd7ddbf2bd)

13 years agoFix comment about GNUTLS initialization/cleanup
Daniel P. Berrange [Tue, 10 Apr 2012 11:15:46 +0000 (12:15 +0100)] 
Fix comment about GNUTLS initialization/cleanup
(cherry picked from commit 20171c8dc0e3efec7437d8d00e32737d9909e4f7)

13 years agoFix compilation error on 32bit
Stefan Berger [Tue, 10 Apr 2012 10:24:03 +0000 (06:24 -0400)] 
Fix compilation error on 32bit

Below code failed to compile on a 32 bit machine with error

typewrappers.c: In function 'libvirt_intUnwrap':
typewrappers.c:135:5: error: logical 'and' of mutually exclusive tests is always false [-Werror=logical-op]
cc1: all warnings being treated as errors

The patch fixes this error.

(cherry picked from commit 4e9bb1dffdf456282b69ab077288c9bf875b8afa)

13 years agoUML: fix iteration over consoles
MATSUDA, Daiki [Mon, 9 Apr 2012 03:40:52 +0000 (12:40 +0900)] 
UML: fix iteration over consoles

I found typo in UML driver.

MATSUDA Daiki
(cherry picked from commit 257191c9e4aa7a361a805baf37f4bb9d50440b43)

13 years agosnapshot: fix memory leak on error
Eric Blake [Thu, 5 Apr 2012 19:15:03 +0000 (13:15 -0600)] 
snapshot: fix memory leak on error

Leak introduced in commit 0436d32.  If we allocate an actions array,
but fail early enough to never consume it with the qemu monitor
transaction call, we leaked memory.

But our semantics of making the transaction command free the caller's
memory is awkward; avoiding the memory leak requires making every
intermediate function in the call chain check for error.  It is much
easier to fix things so that the function that allocates also frees,
while the call chain leaves the caller's data intact.  To do that,
I had to hack our JSON data structure to make it easy to protect a
portion of an arbitrary JSON tree from being freed.

* src/util/json.h (virJSONType): Name the enum.
(_virJSONValue): New field.
* src/util/json.c (virJSONValueFree): Use it to protect a portion
of an array.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONTransaction): Avoid
freeing caller's data.
* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive):
Free actions array on failure.
(cherry picked from commit 1413560966eb07732b56dc2b83215462533656e5)

13 years agoqemu_ga: Don't overwrite errors on FSThaw
Michal Privoznik [Fri, 6 Apr 2012 10:33:48 +0000 (12:33 +0200)] 
qemu_ga: Don't overwrite errors on FSThaw

We can tell qemuDomainSnapshotFSThaw if we want it to report errors or
not. However, if we don't want to and an error has been already set by
previous qemuReportError() we must keep copy of that error not just a
pointer to it. Otherwise, it get overwritten if FSThaw reports an error.
(cherry picked from commit 650da0e99c56f4142273f4e369ad02bd0c008765)

13 years agoxen config: No vfb in HVM guest configuration
Stefan Bader [Thu, 5 Apr 2012 16:44:35 +0000 (18:44 +0200)] 
xen config: No vfb in HVM guest configuration

This causes an implicit vkbd device to be added which takes
6min to finally fail being initialized in the guest.

http://lists.xen.org/archives/html/xen-devel/2012-04/msg00409.html

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
(cherry picked from commit fb98da005071f7f9a5d222b3829901682732900c)

13 years agotests: avoid compiler warnings
Eric Blake [Fri, 6 Apr 2012 02:04:23 +0000 (20:04 -0600)] 
tests: avoid compiler warnings

gcc 4.7 warns about uninitialized struct members

* tests/testutilsqemu.c (testQemuCapsInit): Populate new members.
* tests/viruritest.c (mymain): Likewise.
(cherry picked from commit 72505073bdae80a056e32f762d645e6128e9ca32)

13 years agotest: fix build errors with gcc 4.7.0 and -O0
Laine Stump [Thu, 5 Apr 2012 20:31:36 +0000 (16:31 -0400)] 
test: fix build errors with gcc 4.7.0 and -O0

When building on Fedora 17 (which uses gcc 4.7.0) with -O0 in CFLAGS,
three of the tests failed to compile.

cputest.c and qemuxml2argvtest.c had non-static structs defined
inside the macro that was being repeatedly invoked. Due to some so-far
unidentified change in gcc, the stack space used by variables defined
inside { } is not recovered/re-used when the block ends, so all these
structs have become additive (this is the same problem worked around
in commit cf57d345b). Fortunately, these two files could be fixed with
a single line addition of "static" to the struct definition in the
macro.

virnettlscontexttest.c was a bit different, though. The problem structs
in the do/while loop of macros had non-constant initializers, so it
took a bit more work and piecemeal initialization instead of member
initialization to get things to be happy.

In an ideal world, none of these changes should be necessary, but not
knowing how long it will be until the gcc regressions are fixed, and
since the code is just as correct after this patch as before, it makes
sense to fix libvirt's build for -O0 while also reporting the gcc
problem.
(cherry picked from commit 06a1a45cef57eb770069839e98a51bbb6d8eec9d)

13 years agovirURIParse: don't forget to copy the user part
Guido Günther [Thu, 5 Apr 2012 15:52:42 +0000 (17:52 +0200)] 
virURIParse: don't forget to copy the user part

This got dropped with 300e60e15b22387dda41ed5985a9ebadfd86dd25

Cheers,
 -- Guido
(cherry picked from commit 4eb1c2560d1ab8bae620788d343e9e7b32ddc066)

13 years agotest: fix segfault in networkxml2argvtest
Laine Stump [Thu, 5 Apr 2012 07:18:33 +0000 (03:18 -0400)] 
test: fix segfault in networkxml2argvtest

This bug resolves https://bugzilla.redhat.com/show_bug.cgi?id=810100

rpm builds for i686 were failing with a segfault in
networkxml2argvtest. Running under valgrind showed that a region of
memory was being referenced after it had been freed (as the result of
realloc - see the valgrind report in the BZ).

The problem (in replaceTokens() - added in commit 22ec60, meaning this
bug was in 0.9.10 and 0.9.11) was that the pointers token_start and
token_end were being computed based on the value of *buf, then *buf
was being realloc'ed (potentially moving it), then token_start and
token_end were used without recomputing them to account for movement
of *buf.

The solution is to change the code so that token_start and token_end
are offsets into *buf rather than pointers. This way there is only a
single pointer to the buffer, and nothing needs readjusting after a
realloc. (You may note that some uses of token_start/token_end didn't
need to be changed to add in "*buf +" - that's because there ended up
being a +*buf and -*buf which canceled each other out).

DV gets the credit for finding this bug and pointing out the valgrind
report.
(cherry picked from commit bde32b1ada0d0c8d9e3f82bebe19472b620ef54e)

13 years agoconf: Plug memory leaks on virDomainDiskDefParseXML
Alex Jia [Thu, 5 Apr 2012 09:12:12 +0000 (17:12 +0800)] 
conf: Plug memory leaks on virDomainDiskDefParseXML

Detected by valgrind. Leaks are introduced in commit b22eaa7.

* src/conf/domain_conf.c (virDomainDiskDefParseXML): fix memory leaks.

How to reproduce?

% make && make -C tests check TESTS=qemuxml2argvtest
% cd tests && valgrind -v --leak-check=full ./qemuxml2argvtest

actual result:

==2143== 12 bytes in 2 blocks are definitely lost in loss record 74 of 179
==2143==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==2143==    by 0x39D90A67DD: xmlStrndup (xmlstring.c:45)
==2143==    by 0x4F5EC0: virDomainDiskDefParseXML (domain_conf.c:3438)
==2143==    by 0x502F00: virDomainDefParseXML (domain_conf.c:8304)
==2143==    by 0x505FE3: virDomainDefParseNode (domain_conf.c:9080)
==2143==    by 0x5069AE: virDomainDefParse (domain_conf.c:9030)
==2143==    by 0x41CBF4: testCompareXMLToArgvHelper (qemuxml2argvtest.c:105)
==2143==    by 0x41E5DD: virtTestRun (testutils.c:145)
==2143==    by 0x416FA3: mymain (qemuxml2argvtest.c:399)
==2143==    by 0x41DCB7: virtTestMain (testutils.c:700)
==2143==    by 0x39CF01ECDC: (below main) (libc-start.c:226)

Signed-off-by: Alex Jia <ajia@redhat.com>
(cherry picked from commit 80d476a92ff0b5c2db00fdf37842757f45e30560)

13 years agoopenvz: support vzctl 3.1
Ilja Livenson [Wed, 4 Apr 2012 20:30:43 +0000 (14:30 -0600)] 
openvz: support vzctl 3.1

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

Basically, openvz dropped strict version numbering (3.1 vs 3.1.0),
which caused parsing to fail.
(cherry picked from commit 37075dfe6ccdb5a257cdd64194b5fdd51458fa8b)

13 years agoDon't install sysctl file on non-Linux hosts
Daniel P. Berrange [Wed, 4 Apr 2012 10:16:34 +0000 (11:16 +0100)] 
Don't install sysctl file on non-Linux hosts

* configure.ac: Set WITH_SYSCTL only on Linux hosts
* daemon/Makefile.am: Conditionalize install-sysctl using WITH_SYSCTL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Cc: Jason Helfman <jhelfman@e-e.com>
(cherry picked from commit e7eca6e4be5175ec127a4327462b4374953b9bc5)

13 years agoFix parallel build in docs/ directory
Daniel P. Berrange [Wed, 4 Apr 2012 11:26:04 +0000 (12:26 +0100)] 
Fix parallel build in docs/ directory

Every now & then, with parallel builds, we get a failure to
validate hvsupport.html.in.  I eventually noticed that this
is because we get 2 instances of the generator running at
once.

We already list hvsupport.html.in in BUILT_SOURCES but this
was not working. It turns out the flaw is that we were
adding deps to the 'all:' target instead of the 'all-am:'
target. BUILT_SOURCES is a dep of 'all', so any custom
targets written in Makefile.am must use 'all-am:' so that
they don't get run until BUILT_SOURCES are completely
generated

* docs/Makefile.am: s/all/all-am/
(cherry picked from commit 4f4b496e782dd20d105b89f89e07288772555346)

13 years agoPull in GNULIB regex module for benefit of test suite on Win32
Daniel P. Berrange [Wed, 4 Apr 2012 10:56:04 +0000 (11:56 +0100)] 
Pull in GNULIB regex module for benefit of test suite on Win32
(cherry picked from commit f94d9c5793cc57b5228c7f1915bdc76c84f0a923)

13 years agoAdd linuxNodeInfoCPUPopulate to src/libvirt_linux.syms
Daniel P. Berrange [Wed, 4 Apr 2012 10:54:27 +0000 (11:54 +0100)] 
Add linuxNodeInfoCPUPopulate to src/libvirt_linux.syms

This symbol is used in the test suites

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 06180ca433de3db9e544213afc3d87270aaa8901)

13 years agoFix format specifiers in test cases on Win32
Daniel P. Berrange [Thu, 29 Mar 2012 09:41:37 +0000 (10:41 +0100)] 
Fix format specifiers in test cases on Win32

Some of the test suites use fprintf with format specifiers
that are not supported on Win32 and are not fixed by gnulib.

The mingw32 compiler also has trouble detecting ssize_t
correctly, complaining that 'ssize_t' does not match
'signed size_t' (which it expects for %zd). Force the
cast to size_t to avoid this problem

* tests/testutils.c, tests/testutils.h: Fix printf
  annotation on virTestResult. Use virVasprintf
  instead of vfprintf
* tests/virhashtest.c: Use VIR_WARN instead of fprintf(stderr).
  Cast to size_t to avoid mingw32 compiler bug

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit f48de0f161348d0b47743e1411796d4e40160546)

13 years agoqemu: Build activeUsbHostdevs list on process reconnect
Michal Privoznik [Mon, 26 Mar 2012 14:44:19 +0000 (16:44 +0200)] 
qemu: Build activeUsbHostdevs list on process reconnect

If the daemon is restarted it will lose list of active
USB devices assigned to active domains. Therefore we need
to rebuild this list on qemuProcessReconnect().
(cherry picked from commit ea3bc548aca7b4c448b48863120ad35a7337c127)

13 years agoqemu: Delete USB devices used by domain on stop
Michal Privoznik [Mon, 26 Mar 2012 14:40:01 +0000 (16:40 +0200)] 
qemu: Delete USB devices used by domain on stop

To prevent assigning one USB device to two domains,
we keep a list of assigned USB devices. On domain
startup - qemuProcessStart() - we insert devices
used by domain into the list but remove them only
on detach-device. Devices are, however, released
on qemuProcessStop() as well.
(cherry picked from commit e2f5dd6134ebeb6846450c7d7782273d3d274859)

13 years agoqemu: Don't leak temporary list of USB devices
Michal Privoznik [Mon, 26 Mar 2012 14:33:58 +0000 (16:33 +0200)] 
qemu: Don't leak temporary list of USB devices

and add debug message when adding USB device
to the list of active devices.
(cherry picked from commit b2c7b9ee0e6f2203984035668c066be37f3a256a)