]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
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
(cherry picked from commit 3f029fb5319b9dc9cc2fbf8d1ba4505ee9e4b1e3)

Conflicts:
src/conf/domain_conf.c
src/lxc/lxc_container.c

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.
(cherry picked from commit 3e8343e1510741623aa5bc1dfb74ec39fde868dd)

11 years agovirDomainDefParseXML: set the argument of virBitmapFree to NULL after calling virBitm...
Liuji (Jeremy) [Wed, 11 Sep 2013 02:13:32 +0000 (22:13 -0400)] 
virDomainDefParseXML: set the argument of virBitmapFree to NULL after calling virBitmapFree

After freeing the bitmap pointer, it must set the pointer to NULL.
This will avoid any other use of the freed memory of the bitmap pointer.

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

Signed-off-by: Liuji (Jeremy) <jeremy.liu@huawei.com>
(cherry picked from commit ef5d51d491356f1f4287aa3a8b908b183b6dd9aa)

11 years agovirsh domjobinfo: Do not return 1 if job is NONE
Jiri Denemark [Wed, 11 Sep 2013 13:49:48 +0000 (15:49 +0200)] 
virsh domjobinfo: Do not return 1 if job is NONE

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

Commit 38ab1225 changed the default value of ret from true to false but
forgot to set ret = true when job is NONE. Thus, virsh domjobinfo
returned 1 when there was no job running for a domain but it used to
(and should) return 0 in this case.
(cherry picked from commit f084caae7c5db8ae03e7fafce164c73f65681843)

12 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.

(cherry picked from commit 609eb987c6cef9082486e66b666f7b9351b783ed)

12 years agoFix max stream packet size for old clients
Daniel P. Berrange [Mon, 30 Sep 2013 16:27:51 +0000 (17:27 +0100)] 
Fix max stream packet size for old clients

The libvirtd server pushes data out to clients. It does not
know what protocol version the client might have, so must be
conservative and use the old payload limits. ie send no more
than 256kb of data per packet.

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

12 years agoFix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296)
Daniel P. Berrange [Tue, 3 Sep 2013 15:52:06 +0000 (16:52 +0100)] 
Fix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296)

The 'stats' variable was not initialized to NULL, so if some
early validation of the RPC call fails, it is possible to jump
to the 'cleanup' label and VIR_FREE an uninitialized pointer.
This is a security flaw, since the API can be called from a
readonly connection which can trigger the validation checks.

This was introduced in release v0.9.1 onwards by

  commit 158ba8730e44b7dd07a21ab90499996c5dec080a
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Apr 13 16:21:35 2011 +0100

    Merge all returns paths from dispatcher into single path

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

Conflicts:
daemon/remote.c - context

12 years agoAdd support for using 3-arg pkcheck syntax for process (CVE-2013-4311)
Daniel P. Berrange [Wed, 28 Aug 2013 14:25:40 +0000 (15:25 +0100)] 
Add support for using 3-arg pkcheck syntax for process (CVE-2013-4311)

With the existing pkcheck (pid, start time) tuple for identifying
the process, there is a race condition, where a process can make
a libvirt RPC call and in another thread exec a setuid application,
causing it to change to effective UID 0. This in turn causes polkit
to do its permission check based on the wrong UID.

To address this, libvirt must get the UID the caller had at time
of connect() (from SO_PEERCRED) and pass a (pid, start time, uid)
triple to the pkcheck program.

Signed-off-by: Colin Walters <walters@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 922b7fda77b094dbf022d625238262ea05335666)

Conflicts:
src/access/viraccessdriverpolkit.c

Resolution:
  Dropped file that does not exist in this branch.

12 years agovirFileNBDDeviceAssociate: Avoid use of uninitialized variable
Michal Privoznik [Tue, 3 Sep 2013 16:56:06 +0000 (18:56 +0200)] 
virFileNBDDeviceAssociate: Avoid use of uninitialized variable

The @qemunbd variable can be used uninitialized.

(cherry picked from commit 2dba0323ff0cec31bdcea9dd3b2428af297401f2)

12 years agovirbitmap: Refactor virBitmapParse to avoid access beyond bounds of array
Peter Krempa [Fri, 16 Aug 2013 10:22:32 +0000 (12:22 +0200)] 
virbitmap: Refactor virBitmapParse to avoid access beyond bounds of array

The virBitmapParse function was calling virBitmapIsSet() function that
requires the caller to check the bounds of the bitmap without checking
them. This resulted into crashes when parsing a bitmap string that was
exceeding the bounds used as argument.

This patch refactors the function to use virBitmapSetBit without
checking if the bit is set (this function does the checks internally)
and then counts the bits in the bitmap afterwards (instead of keeping
track while parsing the string).

This patch also changes the "parse_error" label to a more common
"error".

The refactor should also get rid of the need to call sa_assert on the
returned variable as the callpath should allow coverity to infer the
possible return values.

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

Thanks to Alex Jia for tracking down the issue. This issue is introduced
by commit 0fc8909.

(cherry picked from commit 47b9127e883677a0d60d767030a147450e919a25)

12 years agoqemu: fix double free in qemuMigrationPrepareDirect
Ján Tomko [Wed, 10 Jul 2013 10:33:29 +0000 (12:33 +0200)] 
qemu: fix double free in qemuMigrationPrepareDirect

Remove assignment of the string freed by virURIFree
to hostname, since it's not used anywhere.

Double free introduced by ddf8ad8, useless code
introduced by f03dcc5.

https://bugzilla.redhat.com/show_bug.cgi?id=977961
(cherry picked from commit 5744d96f211160d406ec0498c2f814a67d1a3fc8)

12 years agostorage: return -1 when fs pool can't be mounted
Ján Tomko [Thu, 11 Jul 2013 10:36:59 +0000 (12:36 +0200)] 
storage: return -1 when fs pool can't be mounted

Don't reuse the return value of virStorageBackendFileSystemIsMounted.
If it's 0, we'd return it even if the mount command failed.

Also, don't report another error if it's -1, since one has already
been reported.

Introduced by 258e06c.

https://bugzilla.redhat.com/show_bug.cgi?id=981251
(cherry picked from commit 13fde7ceab556804dc6cfb3e56938fb948ffe83d)

12 years agoqemu: fix return value of qemuDomainBlockPivot on errors
Ján Tomko [Mon, 1 Jul 2013 10:41:34 +0000 (12:41 +0200)] 
qemu: fix return value of qemuDomainBlockPivot on errors

If qemuMonitorBlockJob returned 0, qemuDomainBlockPivot
might return 0 even if an error occured.

https://bugzilla.redhat.com/show_bug.cgi?id=977678
(cherry picked from commit c34107dfd3a25232255e6d6f559b1306ef99bb3b)

12 years agoscsi: Fix construction of sysfs device path
Viktor Mihajlovski [Mon, 8 Jul 2013 16:57:58 +0000 (18:57 +0200)] 
scsi: Fix construction of sysfs device path

The device bus value was used instead of the device target when
building the sysfs device path. Trivial.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
(cherry picked from commit 2c94e00c6098662661cd67a10e982a32b6054a3c)

12 years agoFix vPort management: FC vHBA creation
Dennis Chen [Fri, 28 Jun 2013 09:59:51 +0000 (11:59 +0200)] 
Fix vPort management: FC vHBA creation

When creating a virtual FC HBA with virsh/libvirt API, an error message
will be returned: "error: Node device not found",
also the 'nodedev-dumpxml' shows wrong information of wwpn & wwnn
for the new created device.

Signed-off-by: xschen@tnsoft.com.cn
This reverts f90af69 which switched wwpn & wwwn in the wrong place.

https://www.kernel.org/doc/Documentation/scsi/scsi_fc_transport.txt
(cherry picked from commit 3c0d5e224c71cd85b123cd938eeb360502503cb0)

12 years agobridge: don't crash on bandwidth unplug with no bandwidth
Ján Tomko [Fri, 21 Jun 2013 17:20:31 +0000 (19:20 +0200)] 
bridge: don't crash on bandwidth unplug with no bandwidth

If networkUnplugBandwidth is called on a network which has
no bandwidth defined, print a warning instead of crashing.

This can happen when destroying a domain with bandwidth if
bandwidth was removed from the network after the domain was
started.

https://bugzilla.redhat.com/show_bug.cgi?id=975359
(cherry picked from commit 658c932ab4aec2222b0ce3840a96748e73b39b3f)

12 years agoCrash of libvirtd by unprivileged user in virConnectListAllInterfaces
Daniel P. Berrange [Fri, 28 Jun 2013 12:21:33 +0000 (13:21 +0100)] 
Crash of libvirtd by unprivileged user in virConnectListAllInterfaces

On Thu, Jun 27, 2013 at 03:56:42PM +0100, Daniel P. Berrange wrote:
> Hi Security Team,
>
> I've discovered a way for an unprivileged user with a readonly connection
> to libvirtd, to crash the daemon.

Ok, the final patch for this is issue will be the simpler variant that
Eric suggested

The embargo can be considered to be lifted on Monday July 1st, at
0900 UTC

The following is the GIT change that DV or myself will apply to libvirt
GIT master immediately before the 1.1.0 release:

>From 177b4165c531a4b3ba7f6ab6aa41dca9ceb0b8cf Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Fri, 28 Jun 2013 10:48:37 +0100
Subject: [PATCH] CVE-2013-2218: Fix crash listing network interfaces with
 filters

The virConnectListAllInterfaces method has a double-free of the
'struct netcf_if' object when any of the filtering flags cause
an interface to be skipped over. For example when running the
command 'virsh iface-list --inactive'

This is a regression introduced in release 1.0.6 by

  commit 7ac2c4fe624f30f2c8270116513fa2ddab07631f
  Author: Guannan Ren <gren@redhat.com>
  Date:   Tue May 21 21:29:38 2013 +0800

    interface: list all interfaces with flags == 0

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

12 years agoFix invalid read in virCgroupGetValueStr
Ján Tomko [Wed, 26 Jun 2013 11:07:24 +0000 (13:07 +0200)] 
Fix invalid read in virCgroupGetValueStr

Don't check for '\n' at the end of file if zero bytes were read.

Found by valgrind:
==404== Invalid read of size 1
==404==    at 0x529B09F: virCgroupGetValueStr (vircgroup.c:540)
==404==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
==404==    by 0x1EB475: qemuSetupCgroupForEmulator (qemu_cgroup.c:1061)
==404==    by 0x1D9489: qemuProcessStart (qemu_process.c:3801)
==404==    by 0x18557E: qemuDomainObjStart (qemu_driver.c:5787)
==404==    by 0x190FA4: qemuDomainCreateWithFlags (qemu_driver.c:5839)

Introduced by 0d0b409.

https://bugzilla.redhat.com/show_bug.cgi?id=978356
(cherry picked from commit 306c49ffd56a1c72b1892d50f2a75531c62f4a1d)

12 years agoPlug leak in virCgroupMoveTask
Ján Tomko [Wed, 26 Jun 2013 12:55:27 +0000 (14:55 +0200)] 
Plug leak in virCgroupMoveTask

We only break out of the while loop if *content is an empty string.
However the buffer has been allocated to BUFSIZ + 1 (8193 in my case),
but it gets overwritten in the next for iteration.

Move VIR_FREE right before we overwrite it to avoid the leak.

==5777== 16,386 bytes in 2 blocks are definitely lost in loss record 1,022 of 1,027
==5777==    by 0x5296E28: virReallocN (viralloc.c:184)
==5777==    by 0x52B0C66: virFileReadLimFD (virfile.c:1137)
==5777==    by 0x52B0E1A: virFileReadAll (virfile.c:1199)
==5777==    by 0x529B092: virCgroupGetValueStr (vircgroup.c:534)
==5777==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)

Introduced by 83e4c77.

https://bugzilla.redhat.com/show_bug.cgi?id=978352
(cherry picked from commit 5bc8ecb8d1170f41d4c177c1cf0e87c54194a3a3)

12 years agovirsh: edit: don't leak XML string on reedit or redefine
Ján Tomko [Tue, 25 Jun 2013 13:10:27 +0000 (15:10 +0200)] 
virsh: edit: don't leak XML string on reedit or redefine

Free the old XML strings before overwriting them if the user
has chosen to reedit the file or force the redefinition.

Found by Alex Jia trying to reproduce another bug:
https://bugzilla.redhat.com/show_bug.cgi?id=977430#c3
(cherry picked from commit 1e3a252974c8e5c650f1d84dc2b167f0ae8cee3c)

12 years agolxc: Resolve issue with GetScheduler APIs for non running domain
John Ferlan [Tue, 28 May 2013 19:00:59 +0000 (15:00 -0400)] 
lxc: Resolve issue with GetScheduler APIs for non running domain

As a consequence of the cgroup layout changes from commit 'cfed9ad4', the
lxcDomainGetSchedulerParameters[Flags]()' and lxcGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.
(cherry picked from commit 38ada092d1ad5f27a24e511173308d568b6b085f)

12 years agoqemu: Resolve issue with GetScheduler APIs for non running domain
John Ferlan [Tue, 28 May 2013 18:52:39 +0000 (14:52 -0400)] 
qemu: Resolve issue with GetScheduler APIs for non running domain

As a consequence of the cgroup layout changes from commit '632f78ca', the
qemuDomainGetSchedulerParameters[Flags]()' and qemuGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.
(cherry picked from commit b23754534193fb7a1e31306d94ae5f09759a0aa4)

12 years agonodedev: fix vport detection for FC HBA
Ján Tomko [Wed, 12 Jun 2013 08:30:13 +0000 (10:30 +0200)] 
nodedev: fix vport detection for FC HBA

Use the host number as the host number when constructing the sysfs path
instead of the variable we are trying to fill.

https://bugzilla.redhat.com/show_bug.cgi?id=973543
(cherry picked from commit 371c15517c919e9d7d2ea3f66e490bd49b6db384)

12 years agoqemu: Avoid leaking uri in qemuMigrationPrepareDirect
Jiri Denemark [Tue, 18 Jun 2013 11:38:55 +0000 (13:38 +0200)] 
qemu: Avoid leaking uri in qemuMigrationPrepareDirect

(cherry picked from commit ddf8ad82eb5f638d6153f4b1869af17dca572e67)

12 years agolibvirt_private.syms: add virProcessGetStartTime
Ján Tomko [Wed, 12 Jun 2013 08:13:29 +0000 (10:13 +0200)] 
libvirt_private.syms: add virProcessGetStartTime

https://bugzilla.redhat.com/show_bug.cgi?id=973543
(cherry picked from commit cbb3b71d3f537ead2b3081a06abd12292d0ceef3)

12 years agovirtlockd: fix socket path
Ján Tomko [Tue, 4 Jun 2013 11:36:56 +0000 (13:36 +0200)] 
virtlockd: fix socket path

Change the socket path to match the one used by lockd driver.

https://bugzilla.redhat.com/show_bug.cgi?id=968128
(cherry picked from commit 70fe129546545f9683ce57e6946dd80a08b54d2b)

12 years agospec: Explicitly require libgcrypt-devel
Jiri Denemark [Mon, 3 Jun 2013 12:57:29 +0000 (14:57 +0200)] 
spec: Explicitly require libgcrypt-devel

Our configure.ac says:

    Not all versions of gnutls include -lgcrypt, and so we add
    it explicitly for the calls to gcry_control/check_version

Thus we cannot rely on gnutls-devel to bring grcypt-devel as a
dependency.
(cherry picked from commit 3b50a711f0e40cff3f415b87f8b38c785f3cce91)

12 years agoFix warning about using an uninitialized next_unit value
Jiri Denemark [Mon, 3 Jun 2013 10:19:09 +0000 (12:19 +0200)] 
Fix warning about using an uninitialized next_unit value

Using an uninitialized value and a bool saying if the value is valid may
confuse compilators.
(cherry picked from commit 4db39e3fee6ae75ea772767e72e276bccd10bb11)

12 years agouse virBitmapFree instead of VIR_FREE for cpumask
Ján Tomko [Sat, 1 Jun 2013 21:29:09 +0000 (23:29 +0200)] 
use virBitmapFree instead of VIR_FREE for cpumask

Found by 'git grep FREE.*cpumask' after looking at 31f1f6b.
(cherry picked from commit de6889590254806456da5e8a7790e2704e6810ed)

12 years agoRelease of libvirt 1.0.6 v1.0.6
Daniel Veillard [Mon, 3 Jun 2013 10:09:56 +0000 (12:09 +0200)] 
Release of libvirt 1.0.6

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: pull localization updates and regenerate the po

12 years agoStorage: Fix the indention of rbd test file
Osier Yang [Tue, 28 May 2013 06:39:42 +0000 (14:39 +0800)] 
Storage: Fix the indention of rbd test file

12 years agonodedev_hal: Modernize the function's style
Osier Yang [Sat, 1 Jun 2013 02:52:17 +0000 (10:52 +0800)] 
nodedev_hal: Modernize the function's style

Use style like:

void
foo (const char *name)
{
    printf("Hello, %s\n", name);
}

Later patches will clean up node_device_hal.c more.

12 years agoconf: Generate address for scsi host device automatically
Osier Yang [Fri, 31 May 2013 10:09:24 +0000 (18:09 +0800)] 
conf: Generate address for scsi host device automatically

With unknown good reasons, the attribute "bus" of scsi device
address is always set to 0, same for attribute "target". (See
virDomainDiskDefAssignAddress).

Though we might need to change the algorithm to honor "bus"
and "target" too, that's a different issue. The address generator
for scsi host device in this patch just follows the unknown
good reasons, only considering the "controller" and "unit".
It walks through all scsi controllers and their units, to see
if the address $controller:0:0:$unit can be used (if not used
by any disk or scsi host device yet), if found one, it sits on
it, otherwise, it creates a new controller (actually the controller
is implicitly created by someone else), and sits on
$new_controller:0:0:0 instead.

12 years agoqemu: prevent termination of guests w/hostdev on driver reconnect
Laine Stump [Fri, 31 May 2013 18:30:09 +0000 (14:30 -0400)] 
qemu: prevent termination of guests w/hostdev on driver reconnect

This should resolve:

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

The problem was that qemuUpdateActivePciHostdevs was returning 0
(success) when no hostdevs were present, but would otherwise return -1
(failure) even when it completed successfully. It is only called from
qemuProcessReconnect(), and when qemuProcessReconnect got back an
error, it would not only stop reconnecting, but would terminate the
guest qemu process "to remove danger of it ending up running twice if
user tries to start it again later".

(This bug was introduced in commit 011cf7ad, which was pushed between
v1.0.2 and v1.0.3, so all maintenance branches from v1.0.3 up to 1.0.5
will need this one line patch applied.)

12 years agovbox: define DYNLIB_NAME for kFreeBSD
Guido Günther [Thu, 30 May 2013 20:07:46 +0000 (22:07 +0200)] 
vbox: define DYNLIB_NAME for kFreeBSD

Similar to what Eric did for Cygwin it helps at least to compile
without --without-vbox

12 years agobuild: skip qemu in tests when !WITH_QEMU
Eric Blake [Fri, 31 May 2013 16:47:22 +0000 (10:47 -0600)] 
build: skip qemu in tests when !WITH_QEMU

A mingw build (where the qemu driver is not built, so WITH_QEMU
is undefined) failed with:

In file included from ../../src/qemu/qemu_command.h:30:0,
                 from ../../tests/testutilsqemu.h:4,
                 from ../../tests/networkxml2xmltest.c:14:
../../src/qemu/qemu_conf.h:53:4: error: #error "Port me"

But since testutilsqemu.c is already conditional, the header
should be likewise.

* tests/testutilsqemu.h: Make content conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoIntroduce virFilePrintf() as a portable fprintf()
Daniel P. Berrange [Fri, 17 May 2013 14:11:24 +0000 (15:11 +0100)] 
Introduce virFilePrintf() as a portable fprintf()

We can't use GNULIB's fprintf-posix due to licensing
incompatibilities. We do already have a portable
formatting via virAsprintf() which we got from GNULIB
though. We can use to create a virFilePrintf() function.

But really gnulib could just provide a 'fprintf'
module, that depended on just its 'asprintf' module.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDocument that runtime changes may be lost after S4 suspend
Jiri Denemark [Fri, 31 May 2013 16:00:48 +0000 (18:00 +0200)] 
Document that runtime changes may be lost after S4 suspend

12 years agoqemu: escape literal IPv6 address in NBD migration
Ján Tomko [Fri, 31 May 2013 11:24:06 +0000 (13:24 +0200)] 
qemu: escape literal IPv6 address in NBD migration

A literal IPv6 must be escaped, otherwise migration fails with:
unable to execute QEMU command 'drive-mirror': address resolution failed
for f0::0d:5901: Servname not supported for ai_socktype
since QEMU treats everything after the first ':' as the port.

12 years agoCheck for existence of interface prior to setting terminate flag
John Ferlan [Fri, 31 May 2013 11:26:30 +0000 (07:26 -0400)] 
Check for existence of interface prior to setting terminate flag

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

During domain destruction it's possible that the learnIPAddressThread has
already removed the interface prior to the teardown filter path being run.
The teardown code would only be telling the thread to terminate.

12 years agoResolve memory leak found by valgrind
John Ferlan [Fri, 31 May 2013 13:07:28 +0000 (09:07 -0400)] 
Resolve memory leak found by valgrind

Commit '6afdfc8e' adjusted the exit and error paths to go through the error
and cleanup labels, but neglected to remove the return ret prior to cleanup.
Also noted the 'type' xml string fetch was never checked for NULL which
could lead to some interesting results.

12 years agoqemu: snapshot: Don't kill access to disk if snapshot creation fails
Peter Krempa [Fri, 31 May 2013 13:38:46 +0000 (15:38 +0200)] 
qemu: snapshot: Don't kill access to disk if snapshot creation fails

If snapshot creation failed for example due to invalid use of the
"REUSE_EXTERNAL" flag, libvirt killed access to the original image file
instead of the new image file. On machines with selinux this kills the
whole VM as the selinux context is enforced immediately.

* qemu_driver.c:qemuDomainSnapshotUndoSingleDiskActive():
    - Kill access to the new image file instead of the old one.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=906639

12 years agoqemu: Fix damaged whitespace
Peter Krempa [Fri, 31 May 2013 13:33:37 +0000 (15:33 +0200)] 
qemu: Fix damaged whitespace

After deleting "WithDriver" from the async job function the code was
unaligned.

12 years agoProperly indent function's opening bracket
Martin Kletzander [Fri, 31 May 2013 12:26:16 +0000 (14:26 +0200)] 
Properly indent function's opening bracket

12 years agobuild: use correct rpc.h for virtlockd
Eric Blake [Thu, 30 May 2013 21:49:40 +0000 (15:49 -0600)] 
build: use correct rpc.h for virtlockd

Commit d671121d was incomplete; I hit another compile fail on
cygwin not finding the correct rpc/rpc.h.

* src/Makefile.am (virtlockd_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: work around cygwin header bug
Eric Blake [Thu, 30 May 2013 20:51:58 +0000 (14:51 -0600)] 
build: work around cygwin header bug

A bug in Cygwin [1] and poor error messages from gcc [2] lead
to this confusing compilation error:

qemu/qemu_monitor.c:418:9: error: passing argument 2 of 'sendmsg' from incmpatible pointer type
/usr/include/sys/socket.h:42:11: note: expected 'const struct msghdr *' but argument is of type 'struct msghdr *'

[1] http://cygwin.com/ml/cygwin/2013-05/msg00451.html
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57475

* src/qemu/qemu_monitor.c (includes): Include <sys/socket.h>
before <sys/un.h>.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: cast [ug]id_t when printing
Eric Blake [Thu, 30 May 2013 13:59:14 +0000 (07:59 -0600)] 
build: cast [ug]id_t when printing

This is a recurring problem for cygwin :)
For example, see commit 23a4df88.

qemu/qemu_driver.c: In function 'qemuStateInitialize':
qemu/qemu_driver.c:691:13: error: format '%d' expects type 'int', but argument 8 has type 'uid_t' [-Wformat]

* src/qemu/qemu_driver.c (qemuStateInitialize): Add casts.
* daemon/remote.c (remoteDispatchAuthList): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: port qemu to cygwin
Eric Blake [Thu, 30 May 2013 03:00:51 +0000 (21:00 -0600)] 
build: port qemu to cygwin

A cygwin build of the qemu driver fails with:

qemu/qemu_process.c: In function 'qemuPrepareCpumap':
qemu/qemu_process.c:1803:31: error: 'CPU_SETSIZE' undeclared (first use in this function)

CPU_SETSIZE is a Linux extension in <sched.h>; a bit more portable
is using sysconf if _SC_NPROCESSORS_CONF is defined (several platforms
have it, including Cygwin).  Ultimately, I would have preferred to
use gnulib's 'nproc' module, but it is currently under an incompatible
license.

* src/qemu/qemu_conf.h (QEMUD_CPUMASK_LEN): Provide definition on
cygwin.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: use correct rpc.h for lockd v1.0.6-rc2
Eric Blake [Thu, 30 May 2013 01:52:58 +0000 (19:52 -0600)] 
build: use correct rpc.h for lockd

On cygwin, the build failed with:

In file included from ./rpc/virnetmessage.h:24:0,
                 from ./rpc/virnetclient.h:29,
                 from locking/lock_driver_lockd.c:31:
./rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

* src/Makefile.am (lockd_la_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: work around broken sasl header
Eric Blake [Wed, 29 May 2013 19:57:01 +0000 (13:57 -0600)] 
build: work around broken sasl header

Compilation on cygwin failed due to a bug in the sasl headers
present on that platform (libsasl2-devel 2.1.26):

In file included from rpc/virnetserverclient.c:27:0:
/usr/include/sasl/sasl.h:230:38: error: expected declaration specifiers or '...' before 'size_t'

Upstream is aware of their bug:
https://bugzilla.cyrusimap.org/show_bug.cgi?id=3759

* src/rpc/virnetserverclient.c (includes): Ensure size_t is
defined before using sasl.h.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: fix typo in earlier commit
Eric Blake [Wed, 29 May 2013 17:06:39 +0000 (11:06 -0600)] 
build: fix typo in earlier commit

Bummer, I committed, then fixed a typo, then tested, and forgot to
amend the commit before pushing 7d21d6b6.

* src/rpc/virnettlscontext.c (includes): Use correct spelling.

12 years agovirsh: migrate: Don't disallow --p2p and --migrateuri
Cole Robinson [Tue, 28 May 2013 19:37:53 +0000 (15:37 -0400)] 
virsh: migrate: Don't disallow --p2p and --migrateuri

Because it's a valid combination. p2p still uses a separate channel
for qemu migration, so there's value in letting the user specify a manual
migrate URI for overriding auto-port, or libvirt's FQDN lookup.

What _isn't_ allowed is --migrateuri and TUNNELLED, since there is
no separate migration channel. Disallow that instead

12 years agoqemu: migration: error if tunnelled + storage specified
Cole Robinson [Tue, 28 May 2013 19:27:45 +0000 (15:27 -0400)] 
qemu: migration: error if tunnelled + storage specified

Since as the code indicates it doesn't work yet, so let's be
explicit about it.

12 years agoqemu: migration: Improve p2p error if we can't open conn
Cole Robinson [Tue, 28 May 2013 19:12:01 +0000 (15:12 -0400)] 
qemu: migration: Improve p2p error if we can't open conn

By actually showing the Open() error to the user

12 years agobuild: fix build without libvirtd
Eric Blake [Wed, 29 May 2013 15:05:33 +0000 (09:05 -0600)] 
build: fix build without libvirtd

Building when configured --with-libvirtd=no fails with:

In file included from ../src/qemu/qemu_command.h:30:0,
                 from testutilsqemu.h:4,
                 from networkxml2xmltest.c:14:
../src/qemu/qemu_conf.h:175:5: error: expected specifier-qualifier-list before 'virStateInhibitCallback'

* src/libvirt_internal.h (virStateInhibitCallback): Move outside
of conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: fix build with newer gnutls
Eric Blake [Wed, 29 May 2013 03:15:08 +0000 (21:15 -0600)] 
build: fix build with newer gnutls

Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
with:

rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]

Yeah, it's stupid that gnutls broke API by moving their declaration
into a new header without including that header from the old one,
but it's easy enough to work around, all without breaking on gnutls
1.4.1 (hello RHEL 5) that lacked the new header.

* configure.ac (gnutls): Check for <gnutls/crypto.h>.
* src/rpc/virnettlscontext.c (includes): Include additional header.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agostorage_conf: Use uid_t/gid_t instead of int to cast the value
Osier Yang [Wed, 22 May 2013 12:05:22 +0000 (20:05 +0800)] 
storage_conf: Use uid_t/gid_t instead of int to cast the value

And error out if the casted value is not same with the original
one, which prevents the bug on platform(s) where uid_t/gid_t
has different size with long.

12 years agostorage_conf: Improve error messages
Osier Yang [Wed, 22 May 2013 12:05:21 +0000 (20:05 +0800)] 
storage_conf: Improve error messages

virStoragePoolDefParseSource:
  * Better error message

virStoragePoolObjLoad:
  * Break the line line

12 years agostorage_conf: Use NULLSTR instead
Osier Yang [Wed, 22 May 2013 12:05:19 +0000 (20:05 +0800)] 
storage_conf: Use NULLSTR instead

12 years agostorage_conf: Improve the memory deallocation of virStorageVolDefParseXML
Osier Yang [Wed, 22 May 2013 12:05:18 +0000 (20:05 +0800)] 
storage_conf: Improve the memory deallocation of virStorageVolDefParseXML

Changes:
  * Add a new goto label "error"
  * Free the strings at "cleanup"
  * Remove the unnecessary frees

12 years agostorage_conf: Improve the memory deallocation of pool def parsing
Osier Yang [Wed, 29 May 2013 10:04:33 +0000 (18:04 +0800)] 
storage_conf: Improve the memory deallocation of pool def parsing

Changes:
    * Free all the strings at "cleanup", instead of freeing them
      in the middle
    * Remove xmlFree
    * s/tmppath/target_path/, to make it more sensible
    * Add new goto label "error"

12 years agoqemuOpenVhostNet: Decrease vhostfdSize on open failure
Michal Privoznik [Fri, 24 May 2013 12:45:06 +0000 (14:45 +0200)] 
qemuOpenVhostNet: Decrease vhostfdSize on open failure

Currently, if there's an error opening /dev/vhost-net (e.g. because
it doesn't exist) but it's not required we proceed with vhostfd array
filled with -1 and vhostfdSize unchanged. Later, when constructing
the qemu command line only non-negative items within vhostfd array
are taken into account. This means, vhostfdSize may be greater than
the actual count of non-negative items in vhostfd array. This results
in improper command line arguments being generated, e.g.:

-netdev tap,fd=21,id=hostnet0,vhost=on,vhostfd=(null)

12 years agobuild: fix build with older gcc
Eric Blake [Tue, 28 May 2013 23:30:30 +0000 (17:30 -0600)] 
build: fix build with older gcc

gcc 4.1.2 (hello, RHEL 5!) fails to build on 32-bit platforms with:

conf/domain_conf.c: In function 'virDomainDefParseXML':
conf/domain_conf.c:10581: warning: integer constant is too large for 'long' type

Problem introduced in commit f8e3221f9.

* src/conf/domain_conf.c (virDomainDefParseXML): Mark large constants.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agobuild: drop unused variable
Eric Blake [Tue, 28 May 2013 23:11:48 +0000 (17:11 -0600)] 
build: drop unused variable

Compilation for mingw failed:

../../src/util/virutil.c: In function 'virGetWin32DirectoryRoot':
../../src/util/virutil.c:1094:9: error: unused variable 'ret' [-Werror=unused-variable]

* src/util/virutil.c (virGetWin32DirectoryRoot): Silence compiler
warning.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agosyntax: fix broken error message in previous patch
Eric Blake [Tue, 28 May 2013 15:49:53 +0000 (09:49 -0600)] 
syntax: fix broken error message in previous patch

Osier Yang pointed out that I introduced a syntax error in my
syntax check (I really shouldn't make last-minute changes without
testing them....).

/bin/sh: -c: line 2: syntax error near unexpected token `;'
/bin/sh: -c: line 2: `  { echo 'maint.mk: incorrect whitespace, see HACKING for rules' 2>&; \'
make: *** [bracket-spacing-check] Error 1

* cfg.mk (bracket-spacing-check): Fix copy-and-paste error.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: Don't report error on successful media eject
Cole Robinson [Tue, 28 May 2013 14:23:00 +0000 (10:23 -0400)] 
qemu: Don't report error on successful media eject

If we are just ejecting media, ret == -1 even after the retry loop
determines that the tray is open, as requested. This means media
disconnect always report's error.

Fix it, and fix some other mini issues:

- Don't overwrite the 'eject' error message if the retry loop fails
- Move the retries decrement inside the loop, otherwise the final loop
  might succeed, yet retries == 0 and we will raise error
- Setting ret = -1 in the disk->src check is unneeded
- Fix comment typos

cc: mprivozn@redhat.com

12 years agosyntax-check: mandate space after mid-line semicolon
Eric Blake [Fri, 24 May 2013 16:43:45 +0000 (10:43 -0600)] 
syntax-check: mandate space after mid-line semicolon

Enforce the style cleanup in the previous patch.

* build-aux/bracket-spacing.pl: Enforce trailing spacing.
* cfg.mk (bracket-spacing-check): Tweak error wording.
* docs/hacking.html.in: Document the rule.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agosyntax: prefer space after semicolon in for loop
Eric Blake [Fri, 24 May 2013 16:58:25 +0000 (10:58 -0600)] 
syntax: prefer space after semicolon in for loop

I noticed several unusual spacings in for loops, and decided to
fix them up.  See the next commit for the syntax check that found
all of these.

* examples/domsuspend/suspend.c (main): Fix spacing.
* python/libvirt-override.c: Likewise.
* src/conf/interface_conf.c: Likewise.
* src/security/virt-aa-helper.c: Likewise.
* src/util/virconf.c: Likewise.
* src/util/virhook.c: Likewise.
* src/util/virlog.c: Likewise.
* src/util/virsocketaddr.c: Likewise.
* src/util/virsysinfo.c: Likewise.
* src/util/viruuid.c: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
default case, to let compiler check us.
* tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoutil: fix the VIR_STRDUP when src is NULL
yangdongsheng [Tue, 28 May 2013 07:13:17 +0000 (15:13 +0800)] 
util: fix the VIR_STRDUP when src is NULL

When src is NULL, VIR_STRDUP will return 0 directly.
This patch will set dest to NULL before VIR_STRDUP return.

Example:
[root@yds-pc libvirt]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type: 'help' for help with commands
'quit' to quit

virsh # connect
error: Failed to connect to the hypervisor
error: internal error Unable to parse URI �N�*

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: Fix build without gnutls v1.0.6-rc1
Jiri Denemark [Mon, 27 May 2013 08:19:36 +0000 (10:19 +0200)] 
qemu: Fix build without gnutls

"error" label in qemuMigrationCookieGraphicsAlloc is now used
unconditionally thanks to VIR_STRDUP.

12 years agoqemu: save domain state to XML after reboot
Sergey Fionov [Sat, 18 May 2013 11:47:51 +0000 (15:47 +0400)] 
qemu: save domain state to XML after reboot

Currently qemuDomainReboot() does reboot in two phases:
qemuMonitorSystemPowerdown() and qemuProcessFakeReboot().

qemuMonitorSystemPowerdown() shutdowns the domain and saves domain
state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN.

qemuProcessFakeReboot() sets domain state/reason to
VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes.

Subsequent restart of libvirtd leads to restoring domain state/reason to
saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of
the domain. This commit adds virDomainSaveStatus() into
qemuProcessFakeReboot() to avoid unexpected shutdowns.

12 years agoesx: Fix dynamic VI object type detection
Matthias Bolte [Sat, 18 May 2013 09:45:04 +0000 (11:45 +0200)] 
esx: Fix dynamic VI object type detection

VI objects support inheritance with subtype polymorphism. For example the
FileInfo object type is extended by FloppyImageFileInfo, FolderFileInfo
etc. Then SearchDatastore_Task returns an array of FileInfo objects and
depending on the represented file the FileInfo is actually a FolderFileInfo
or FloppyImageFileInfo etc. The actual type information is stored as XML
attribute that allows clients such as libvirt to distinguish between the
actual types. esxVI_GetActualObjectType is used to extract the actual type.

I assumed that this mechanism would be used for all VI object types that
have subtypes. But this is not the case. It seems only to be used for types
that are actually used as generic base type such as FileInfo. But it is not
used for types that got extended later such as ElementDescription that was
extended by ExtendedElementDescription (added in vSphere API 4.0) or that
are not meant to be used with subtype polymorphism.

This breaks the deserialization of types that contain ElementDescription
properties such as PerfCounterInfo or ChoiceOption, because the code
expects an ElementDescription object to have an XML attribute named type
that is not present, since ExtendedElementDescription was added to the
esx_vi_generator.input in commit 60f0f55ee4686fecbffc5fb32f90863427d02a14.
This in turn break virtual machine question handling and auto answering.

Fix this by using the base type if no XML type attribute is present.

12 years agospec: Build vbox packages only for x86 architectures
Viktor Mihajlovski [Fri, 24 May 2013 13:44:19 +0000 (15:44 +0200)] 
spec: Build vbox packages only for x86 architectures

Commit 6ab6bc19f03513fd87d29ecfd405bb7f4a7de114 has introduced separate
daemon/driver packages for vbox. These should only be built for x86
architectures which is done hereby.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agosecurity_dac: Fix the coding style
Osier Yang [Fri, 24 May 2013 15:31:28 +0000 (23:31 +0800)] 
security_dac: Fix the coding style

Pushed under trivial rule.

12 years agoAdapt to new VIR_STRNDUP behavior
Michal Privoznik [Fri, 24 May 2013 09:21:36 +0000 (11:21 +0200)] 
Adapt to new VIR_STRNDUP behavior

With previous patch, we accept negative value as length of string to
duplicate. So there is no need to pass strlen(src) in case we want to do
duplicate the whole string.

12 years agovirStrndup: Accept negative values as string length
Michal Privoznik [Fri, 24 May 2013 08:45:57 +0000 (10:45 +0200)] 
virStrndup: Accept negative values as string length

It may shorten the code a bit as the following pattern:

  VIR_STRNDUP(dst, src, cond ? n : strlen(src))

is used on several places among our code. However, we can
move the strlen into virStrndup and thus write just:

  VIR_STRNDUP(dst, src, cond ? n : -1)

12 years agostorage_conf: Fix the error type
Osier Yang [Wed, 22 May 2013 12:05:16 +0000 (20:05 +0800)] 
storage_conf: Fix the error type

s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/.

12 years agostorage_conf: Put "%s" at the same line with error type
Osier Yang [Wed, 22 May 2013 12:05:15 +0000 (20:05 +0800)] 
storage_conf: Put "%s" at the same line with error type

Trivial, but it allows the "error message" to have more spaces.

12 years agostorage_conf: Use xmlStrEqual instead of STREQ
Osier Yang [Wed, 22 May 2013 12:05:14 +0000 (20:05 +0800)] 
storage_conf: Use xmlStrEqual instead of STREQ

And improve the error message

12 years agostorage_conf: Remove the useless casting
Osier Yang [Wed, 22 May 2013 12:05:13 +0000 (20:05 +0800)] 
storage_conf: Remove the useless casting

12 years agostorage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx
Osier Yang [Wed, 22 May 2013 12:05:12 +0000 (20:05 +0800)] 
storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx

Any string returned from virXPathString should be freed.

12 years agostorage_conf: Fix the wrong error message
Osier Yang [Wed, 22 May 2013 12:05:11 +0000 (20:05 +0800)] 
storage_conf: Fix the wrong error message

It's for parsing "login" attribute of "auth".

12 years agosyntax-check: ignore all quoted strings in bracket-spacing
Ján Tomko [Fri, 24 May 2013 08:50:42 +0000 (10:50 +0200)] 
syntax-check: ignore all quoted strings in bracket-spacing

Ignore strings with an escaped double quote too.

This removes the need for special handling of quotes in the
semicolon check.

12 years agonwfilter: Remove error report in virNWFilterDHCPSnoopEnd
Stefan Berger [Fri, 24 May 2013 12:01:03 +0000 (08:01 -0400)] 
nwfilter: Remove error report in virNWFilterDHCPSnoopEnd

Remove error reporting when calling the virNWFilterDHCPSnoopEnd
function with an interface for which no thread is snooping traffic.

Document the usage of this function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
12 years agoFix blkdeviotune for shutoff domain
Martin Kletzander [Thu, 23 May 2013 11:07:34 +0000 (13:07 +0200)] 
Fix blkdeviotune for shutoff domain

Function qemuDomainSetBlockIoTune() was checking QEMU capabilities
even when !(flags & VIR_DOMAIN_AFFECT_LIVE) and the domain was
shutoff, resulting in the following problem:

 virsh # domstate asdf; blkdeviotune asdf vda --write-bytes-sec 100
 shut off

 error: Unable to change block I/O throttle
 error: unsupported configuration: block I/O throttling not supported with this QEMU binary

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

12 years agocgroups: Do not enforce nonexistent controllers
Viktor Mihajlovski [Thu, 23 May 2013 13:26:31 +0000 (15:26 +0200)] 
cgroups: Do not enforce nonexistent controllers

Currently, the controllers argument to virCgroupDetect acts both as
a result filter and a required controller specification, which is
a bit overloaded. If both functionalities are needed, it would be
better to have them seperated into a filter and a requirement mask.
The only situation where it is used today is to ensure that only
CPU related controllers are used for the VCPU directories. But here
we clearly do not want to enforce the existence of cpu, cpuacct and
specifically not cpuset at the same time.
This commit changes the semantics of controllers to "filter only".
Should a required mask ever be needed, more work will have to be done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agovirsh: Fix regression of vol-resize
Osier Yang [Fri, 24 May 2013 03:59:14 +0000 (11:59 +0800)] 
virsh: Fix regression of vol-resize

Introduced by commit 1daa4ba33acf. vshCommandOptStringReq returns
0 on *success* or the option is not required && not present, both
are right result. Error out when returning 0 is not correct.
the caller, it doesn't have to check wether it

12 years agoIntroduce syntax-check rule to prefer VIR_STRDUP over strdup
Michal Privoznik [Thu, 4 Apr 2013 18:16:43 +0000 (20:16 +0200)] 
Introduce syntax-check rule to prefer VIR_STRDUP over strdup

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c
Michal Privoznik [Thu, 23 May 2013 07:51:59 +0000 (09:51 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/*
Michal Privoznik [Fri, 24 May 2013 07:19:51 +0000 (09:19 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/*

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c
Michal Privoznik [Fri, 24 May 2013 07:19:34 +0000 (09:19 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c

This commit is separate due to unusual paradigm compared to the
most source files.

12 years agovirCgroupAddTaskStrController: s/-1/-ENOMEM/
Michal Privoznik [Fri, 24 May 2013 07:49:54 +0000 (09:49 +0200)] 
virCgroupAddTaskStrController: s/-1/-ENOMEM/

Within whole vircgroup.c we 'return -errno', e.g. 'return -ENOMEM'.
However, in this specific function virCgroupAddTaskStrController
we weren't returning -ENOMEM but -1 despite fact that later in
the function we are returning one of errno values indeed.

12 years agoxen: Resolve Coverity FORWARD_NULL issue
John Ferlan [Thu, 23 May 2013 15:07:36 +0000 (11:07 -0400)] 
xen: Resolve Coverity FORWARD_NULL issue

Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.

12 years agodocs: domain: /dev/urandom isn't a valid rng patch
Cole Robinson [Thu, 23 May 2013 18:37:08 +0000 (14:37 -0400)] 
docs: domain: /dev/urandom isn't a valid rng patch

Only /dev/random and /dev/hwrng are accepted, list them explicitly.

12 years agoconf: add missing OOM errors
Ján Tomko [Wed, 22 May 2013 10:56:37 +0000 (12:56 +0200)] 
conf: add missing OOM errors

12 years agoqemu: fix NBD migration to hosts with IPv6 enabled
Ján Tomko [Thu, 23 May 2013 13:51:05 +0000 (15:51 +0200)] 
qemu: fix NBD migration to hosts with IPv6 enabled

Since f03dcc5 we use [::] as the listening address both on qemu
command line in -incoming and in nbd-server-start QMP command.
However the latter requires just :: without the braces.

12 years agoconf: fix use after free in virChrdevOpen
Ján Tomko [Wed, 22 May 2013 10:56:23 +0000 (12:56 +0200)] 
conf: fix use after free in virChrdevOpen

Don't free the stream on error if we've successfully added it
to the hash table, since it will be freed by virChrdevHashEntryFree
callback.

Preserve the error message before calling virStreamFree, since it
resets the error.

Introduced by 4716138, crashing since 6921892.

Reported by Sergey Fionov on libvir-list.

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/*
Michal Privoznik [Fri, 3 May 2013 12:51:56 +0000 (14:51 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/*

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/*
Michal Privoznik [Fri, 3 May 2013 12:51:37 +0000 (14:51 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/*

12 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*
Michal Privoznik [Fri, 3 May 2013 12:51:25 +0000 (14:51 +0200)] 
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*