]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
9 years agotpm: adapt sysfs cancel path for new TPM driver
Stefan Berger [Wed, 18 Nov 2015 00:44:13 +0000 (19:44 -0500)] 
tpm: adapt sysfs cancel path for new TPM driver

This patch addresses BZ 1244895.

Adapt the sysfs TPM command cancel path for the TPM driver that
does not use a miscdevice anymore since Linux 4.0. Support old
and new paths and check their availability.

Add a mockup for the test cases to avoid the testing for
availability of the cancel path.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
(cherry picked from commit 5ed7afa9de4e8d2b7e83fee334a0c3f2bddc6a48)

9 years agolibvirt-guests: Disable shutdown timeout
Guido Günther [Tue, 17 Nov 2015 07:39:46 +0000 (08:39 +0100)] 
libvirt-guests: Disable shutdown timeout

Since we can't know at service start how many VMs will be running we
can't calculate an apropriate shutdown timeout. So instead of killing
off the service just let it use it's own internal timeout mechanism.

References:
    http://bugs.debian.org/803714
    https://bugzilla.redhat.com/show_bug.cgi?id=1195544

(cherry picked from commit ba08d16d6cec81656b333435650aef36a012034c)

9 years agosystemd: Escape only needed characters for machined
Martin Kletzander [Fri, 27 Nov 2015 13:24:38 +0000 (14:24 +0100)] 
systemd: Escape only needed characters for machined

Machine name escaping follows the same rules as serice name escape,
except that '.' and '-' must not be escaped in machine names, due
to a bug in systemd-machined.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 0e0149ce91d84f40b98acf4c4bb0da6e29b9c15c)

9 years agosystemd: Escape machine name for machined
Martin Kletzander [Tue, 24 Nov 2015 14:56:12 +0000 (15:56 +0100)] 
systemd: Escape machine name for machined

According to the documentation, CreateMachine accepts only 7bit ASCII
characters in the machinename parameter, so let's make sure we can start
machines with unicode names with systemd.  We already have a function
for that, we just forgot to use it.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit e24eda48cfae84a9003456b68eaf753a26123639)

9 years agoCVE-2015-5313: storage: don't allow '/' in filesystem volume names
Eric Blake [Wed, 9 Dec 2015 00:46:31 +0000 (17:46 -0700)] 
CVE-2015-5313: storage: don't allow '/' in filesystem volume names

The libvirt file system storage driver determines what file to
act on by concatenating the pool location with the volume name.
If a user is able to pick names like "../../../etc/passwd", then
they can escape the bounds of the pool.  For that matter,
virStoragePoolListVolumes() doesn't descend into subdirectories,
so a user really shouldn't use a name with a slash.

Normally, only privileged users can coerce libvirt into creating
or opening existing files using the virStorageVol APIs; and such
users already have full privilege to create any domain XML (so it
is not an escalation of privilege).  But in the case of
fine-grained ACLs, it is feasible that a user can be granted
storage_vol:create but not domain:write, and it violates
assumptions if such a user can abuse libvirt to access files
outside of the storage pool.

Therefore, prevent all use of volume names that contain "/",
whether or not such a name is actually attempting to escape the
pool.

This changes things from:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
Vol ../../../../../../etc/haha created
$ rm /etc/haha

to:

$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
error: Failed to create vol ../../../../../../etc/haha
error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'

Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 034e47c338b13a95cf02106a3af912c1c5f818d7)

9 years agodocs: event impl. registration before hypervisor connection
Dominik Perpeet [Fri, 25 Sep 2015 08:54:21 +0000 (10:54 +0200)] 
docs: event impl. registration before hypervisor connection

Event implementations need to be registered before a connection to the
Hypervisor is opened, otherwise event handling can be impaired (e.g.
delayed messages). This fact is referenced in an e-mail [1], but should
also be noted in the documentation of the registration functions.

[1] https://www.redhat.com/archives/libvirt-users/2014-April/msg00011.html

(cherry picked from commit 9bf1cef7371b119cf1ad1e83daaa9cd0da893352)

9 years agospec: Fix some warnings with latest rpmbuild
Cole Robinson [Tue, 22 Sep 2015 19:56:50 +0000 (15:56 -0400)] 
spec: Fix some warnings with latest rpmbuild

$ rpmbuild -ba libvirt.spec
warning: Macro expanded in comment on line 5: # If neither fedora nor rhel was defined, try to guess them from %{dist}

warning: Macro %enable_autotools defined but not used within scope
warning: Macro %client_only defined but not used within scope
...

(cherry picked from commit dae1250b24404f7f21e7bd8aeeb304565d175de4)

9 years agoqemu: Fix dynamic_ownership qemu.conf setting
Cole Robinson [Mon, 28 Sep 2015 23:47:09 +0000 (19:47 -0400)] 
qemu: Fix dynamic_ownership qemu.conf setting

Commit 307fb904 (Sep 10) added a 'privileged' variable when creating
the DAC driver:

@@ -153,6 +157,7 @@ virSecurityManagerNewDAC(const char *virtDriver,
                          bool defaultConfined,
                          bool requireConfined,
                          bool dynamicOwnership,
+                         bool privileged,
                          virSecurityManagerDACChownCallback chownCallback)

But argument order is mixed up at the caller, swapping dynamicOwnership
and privileged values. This corrects the argument order

https://bugzilla.redhat.com/show_bug.cgi?id=1266628
(cherry picked from commit 68572de8228e3971174a83c227fcb018d6f684c7)

9 years agoPrep for release 1.2.18.1 v1.2.18.1
Cole Robinson [Tue, 22 Sep 2015 00:54:37 +0000 (20:54 -0400)] 
Prep for release 1.2.18.1

9 years agotest driver: don't unlock pool after freeing it
David Mansfield [Thu, 17 Sep 2015 12:59:24 +0000 (08:59 -0400)] 
test driver: don't unlock pool after freeing it

 Invalid read of size 4
    at 0x945CA30: __pthread_mutex_unlock_full (in /lib64/libpthread-2.20.so)
    by 0x4F0404B: virMutexUnlock (virthread.c:94)
    by 0x4F7161B: virStoragePoolObjUnlock (storage_conf.c:2603)
    by 0x4FE0476: testStoragePoolUndefine (test_driver.c:4328)
    by 0x4FCF086: virStoragePoolUndefine (libvirt-storage.c:656)
    by 0x15A7F5: cmdPoolUndefine (virsh-pool.c:1721)
    by 0x12F48D: vshCommandRun (vsh.c:1212)
    by 0x132AA7: main (virsh.c:943)
  Address 0xfda56a0 is 16 bytes inside a block of size 104 free'd
    at 0x4C2BA6C: free (vg_replace_malloc.c:473)
    by 0x4EA5C96: virFree (viralloc.c:582)
    by 0x4F70B69: virStoragePoolObjFree (storage_conf.c:412)
    by 0x4F7167B: virStoragePoolObjRemove (storage_conf.c:437)
    by 0x4FE0468: testStoragePoolUndefine (test_driver.c:4323)
    by 0x4FCF086: virStoragePoolUndefine (libvirt-storage.c:656)
    by 0x15A7F5: cmdPoolUndefine (virsh-pool.c:1721)
    by 0x12F48D: vshCommandRun (vsh.c:1212)
    by 0x132AA7: main (virsh.c:943)

(cherry picked from commit 03cf57a37df750da46289b0f8aeac6463d521785)

9 years agolibxl: fix AttachDeviceConfig on hostdev type
Chunyan Liu [Thu, 17 Sep 2015 05:15:22 +0000 (01:15 -0400)] 
libxl: fix AttachDeviceConfig on hostdev type

After attach-device a <hostdev> with --config, new device doesn't
show up in dumpxml and in guest.

To fix that, set dev->data.hostdev = NULL after work so that the
pointer is not freed, since vmdef has the pointer and still need it.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
(cherry picked from commit 56945e1374bd254148643d76a98fba9be67fba15)

9 years agosecurity_selinux: Take @privileged into account
Michal Privoznik [Thu, 10 Sep 2015 11:27:28 +0000 (13:27 +0200)] 
security_selinux: Take @privileged into account

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

If running in session mode it may happen that we fail to set
correct SELinux label, but the image may still be readable to
the qemu process. Take this into account.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 00e5b967168bab252ea2bef977ad40b4155f08df)

9 years agoselinux: fix compile errors
Guido Günther [Mon, 24 Aug 2015 12:04:37 +0000 (14:04 +0200)] 
selinux: fix compile errors

Remove unused variable, tag unused parameter and adjust return type.

introduced by 3f48345f7ec0c44b8ce2371cab454d2118f830b4

CC     security/libvirt_security_manager_la-security_selinux.lo
security/security_selinux.c: In function 'virSecuritySELinuxDomainSetDirLabel':
security/security_selinux.c:2520:5: error: return makes pointer from integer without a cast [-Werror]
security/security_selinux.c:2514:9: error: unused variable 'ret' [-Werror=unused-variable]
security/security_selinux.c:2509:59: error: unused parameter 'mgr' [-Werror=unused-parameter]

(cherry picked from commit 4d4c90dfd5475c100c6fd3fb705011e0d90d793e)

9 years agosecurity_selinux: Add SetDirLabel support
Martin Kletzander [Mon, 17 Aug 2015 18:07:07 +0000 (11:07 -0700)] 
security_selinux: Add SetDirLabel support

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3f48345f7ec0c44b8ce2371cab454d2118f830b4)

9 years agosecurity: Add virSecurityDomainSetDirLabel
Martin Kletzander [Mon, 17 Aug 2015 17:43:43 +0000 (10:43 -0700)] 
security: Add virSecurityDomainSetDirLabel

That function can be used for setting security labels on arbitrary
directories.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit f65a2a12f4b9ab6144a979774f0486cdc4f7a60a)

9 years agosecurity_selinux: Use proper structure to access socket data
Martin Kletzander [Thu, 13 Aug 2015 05:35:10 +0000 (07:35 +0200)] 
security_selinux: Use proper structure to access socket data

In virSecuritySELinuxSetSecurityChardevLabel() we are labelling unix
socket path, but accessing another structure of the union.  This does
not pose a problem currently as both paths are at the same offset, but
this should be fixed for the future.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 4ac6ce38d3bc60f45491509ede4fc8437348048c)

9 years agosecurity_selinux: Replace SELinuxSCSICallbackData with proper struct
Michal Privoznik [Thu, 10 Sep 2015 11:49:18 +0000 (13:49 +0200)] 
security_selinux: Replace SELinuxSCSICallbackData with proper struct

We have plenty of callbacks in the driver. Some of these
callbacks require more than one argument to be passed. For that
we currently have a data type (struct) per each callback. Well,
so far for only one - SELinuxSCSICallbackData. But lets turn it
into more general name so it can be reused in other callbacks too
instead of each one introducing a new, duplicate data type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 276c409163fb94b0c325900d6e2581eaa3e3ada6)

9 years agovirSecuritySELinuxSetSecurityAllLabel: drop useless virFileIsSharedFSType
Michal Privoznik [Thu, 10 Sep 2015 11:29:36 +0000 (13:29 +0200)] 
virSecuritySELinuxSetSecurityAllLabel: drop useless virFileIsSharedFSType

The check is done in virSecuritySELinuxSetFilecon itself. There's
no need to check it again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 370461d1dbcdcf63fbe6c34d188c28cf11488845)

9 years agovirSecurityManager: Track if running as privileged
Michal Privoznik [Thu, 10 Sep 2015 09:43:31 +0000 (11:43 +0200)] 
virSecurityManager: Track if running as privileged

We may want to do some decisions in drivers based on fact if we
are running as privileged user or not. Propagate this info there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 307fb9044c1c9a5394b66e6909c6fd943d7f84c8)

9 years agoqemu: hotplug: Properly clean up drive backend if frontend hotplug fails
Peter Krempa [Fri, 11 Sep 2015 15:34:18 +0000 (17:34 +0200)] 
qemu: hotplug: Properly clean up drive backend if frontend hotplug fails

Commit 8125113c added code that should remove the disk backend if the
fronted hotplug failed for any reason. The code had a bug though as it
used the disk string for unplug rather than the backend alias. Fix the
code by pre-creating an alias string and using it instead of the disk
string. In cases where qemu does not support QEMU_CAPS_DEVICE, we ignore
the unplug of the backend since we can't really create an alias in that
case.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1262399
(cherry picked from commit 64c6695f1ad72f0a99faace5deb1caf7effa2275)

9 years agoxen: fix race in refresh of config cache
Daniel P. Berrange [Fri, 11 Sep 2015 13:15:50 +0000 (14:15 +0100)] 
xen: fix race in refresh of config cache

The xenXMConfigCacheRefresh method scans /etc/xen and loads
all config files it finds. It then scans its internal hash
table and purges any (previously) loaded config files whose
refresh timestamp does not match the timestamp recorded at
the start of xenXMConfigCacheRefresh(). There is unfortunately
a subtle flaw in this, because if loading the config files
takes longer than 1 second, some of the config files will
have a refresh timestamp that is 1 or more seconds different
(newer) than is checked for. So we immediately purge a bunch
of valid config files we just loaded.

To avoid this flaw, we must pass the timestamp we record at
the start of xenXMConfigCacheRefresh() into the
xenXMConfigCacheAddFile() method, instead of letting the
latter call time(NULL) again.

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

9 years agolibxl: don't end job for ephemeal domain on start failure
Ian Campbell [Thu, 10 Sep 2015 15:45:07 +0000 (16:45 +0100)] 
libxl: don't end job for ephemeal domain on start failure

commit 4b53d0d4ac9c "libxl: don't remove persistent domain on start
failure" cleans up the vm object and sets it to NULL if the vm is not
persistent, however at end job vm (now NULL) is dereferenced via the call to
libxlDomainObjEndJob. Avoid this by skipping "endjob" and going
straight to "cleanup" in this case.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
(cherry picked from commit ee7758f09bad855f5d0fdf9804d8979cdbbff40e)

9 years agoconf: fix crash when parsing a unordered NUMA <cell/>
Luyao Huang [Tue, 8 Sep 2015 04:59:10 +0000 (12:59 +0800)] 
conf: fix crash when parsing a unordered NUMA <cell/>

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

Introduced by 8fedbbdb, if we parse an unordered NUMA cell, will
get a segfault. This is because of a check for overlapping @cpus
sets we have there. However, since the array to hold guest NUMA
cells is allocated upfront and therefore it contains all zeros,
an out of order cell will break our assumption that cell IDs have
increasing character. At this point we try to access yet NULL
bitmap and therefore segfault.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit 83ae3ee39bd13feddecc49aaad382d5cae72c257)

9 years agoqemu: Check virGetLastError return value for migration finish failure
John Ferlan [Tue, 1 Sep 2015 10:47:55 +0000 (06:47 -0400)] 
qemu: Check virGetLastError return value for migration finish failure

Commit id '2e7cea243' added a check for an error from Finish instead
of 'unexpected error'; however, if for some reason there wasn't an
error, then virGetLastError could return NULL resulting in the
NULL pointer deref to err->domain.

(cherry picked from commit ea3c5f25eb94f08d2a54385362c7ad60c6b1854e)

9 years agolibxl: don't overwrite error from virNetSocketNewConnectTCP()
Jim Fehlig [Thu, 3 Sep 2015 16:14:20 +0000 (10:14 -0600)] 
libxl: don't overwrite error from virNetSocketNewConnectTCP()

Remove redundant error reporting in libxlDomainMigrationPerform().
virNetSocketNewConnectTCP() is perfectly capable of reporting
sensible errors.

(cherry picked from commit 6ce939c2472e8cd97dfe448e902bc878c826351e)

9 years agodomain-conf: escape string for socket attribute
Pavel Hrdina [Mon, 31 Aug 2015 13:33:49 +0000 (15:33 +0200)] 
domain-conf: escape string for socket attribute

Commit d091518b tried to escape all strings in produced XML, but missed
this one.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit e92e5ba12825b32ccc929a527077fb7019c87d1b)

9 years agosrc: Check for symbols ordering in ADMIN_SYM_FILES
Michal Privoznik [Mon, 31 Aug 2015 10:45:16 +0000 (12:45 +0200)] 
src: Check for symbols ordering in ADMIN_SYM_FILES

Like we are checking for the correct order in SYM_FILES, we
should do the same for ADMIN_SYM_FILES.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit a0d2ceb32fe477adbc81fe415549bf495b0c529f)

9 years agosrc: Cleanup libvirt_admin.syms
Michal Privoznik [Mon, 31 Aug 2015 09:37:45 +0000 (11:37 +0200)] 
src: Cleanup libvirt_admin.syms

It's a generated file, so after 'distclean' it should be gone.
But it isn't yet.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 28fa50d22618a941636f777a3e6ce80618fe02b3)

9 years agosrc: Check libvirt_admin.syms for exported symbols
Michal Privoznik [Mon, 31 Aug 2015 09:35:46 +0000 (11:35 +0200)] 
src: Check libvirt_admin.syms for exported symbols

We have this check rule in src/Makefile: check-symfile that
should check if all symbols we wanted to export are exported.
Moreover, if we are not exporting something more. Do the same
with libvirt_admin.syms.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 74f11dd25b162aa3b79b62b7530bc531e1571f34)

9 years agoutil: fallback to ioctl(SIOCBRDELBR) if netlink RTM_DELLINK fails
Laine Stump [Wed, 26 Aug 2015 03:19:03 +0000 (23:19 -0400)] 
util: fallback to ioctl(SIOCBRDELBR) if netlink RTM_DELLINK fails

commit 09778e09 switched from using ioctl(SIOCBRDELBR) for bridge
device deletion to using a netlink RTM_DELLINK message, which is the
more modern way to delete a bridge (and also doesn't require the
bridge to be ~IFF_UP to succeed). However, although older kernels
(e.g. 2.6.32, in RHEL6/CentOS6) support deleting *some* link types
with RTM_NEWLINK, they don't support deleting bridges, and there is no
compile-time way to figure this out.

This patch moves the body of the SIOCBRDELBR version of
virNetDevBridgeDelete() into a static function, calls the new function
from the original, and also calls the new function from the
RTM_DELLINK version if the RTM_DELLINK message generates an EOPNOTSUPP
error. Since RTM_DELLINK is done from the subordinate function
virNetlinkDelLink, which is also called for other purposes (deleting a
macvtap interface), a function pointer called "fallback" has been
added to the arglist of virNetlinkDelLink() - if that arg != NULL, the
provided function will be called when (and only when) RTM_DELLINK
fails with EOPNOTSUPP.

Resolves:  https://bugzilla.redhat.com/show_bug.cgi?id=1252780 (part 2)
(cherry picked from commit 97d26e470d5be2f1178cedfea212c5983afd7b30)

9 years agoutil: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails
Laine Stump [Wed, 26 Aug 2015 00:48:19 +0000 (20:48 -0400)] 
util: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails

commit fc7b23db switched from using ioctl(SIOCBRADDBR) for bridge
creation to using a netlink RTM_NEWLINK message with IFLA_INFO_KIND =
"bridge", which is the more modern way to create a bridge. However,
although older kernels (e.g. 2.6.32, in RHEL6/CentOS6) support
creating *some* link types with RTM_NEWLINK, they don't support
creating bridges, and there is no compile-time way to figure this out
(since the "type" isn't an enum, but rather a character string).

This patch moves the body of the SIOCBRADDBR version of
virNetDevBridgeCreate() into a static function, calls the new function
from the original, and also calls the new function from the
RTM_NEWLINK version if the RTM_NEWLINK message generates an EOPNOTSUPP
error.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1252780
(cherry picked from commit 66dcb4093750aabd637607a1202cb9b9c15f1298)

9 years agolibxl: acquire a job when receiving a migrating domain
Jim Fehlig [Thu, 16 Jul 2015 18:24:32 +0000 (12:24 -0600)] 
libxl: acquire a job when receiving a migrating domain

Commit f86ae403 moved acquiring a job from libxlDomainStart()
to its callers. One spot missed was in libxlDoMigrateReceive().
Acquire a job in libxlDoMigrateReceive() before calling
libxlDomainStart().

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit e80b84a74324cd535ec7232c4e1653805af2103a)

9 years agolibxl: don't attempt to resume domain when suspend fails
Jim Fehlig [Wed, 15 Jul 2015 23:29:15 +0000 (17:29 -0600)] 
libxl: don't attempt to resume domain when suspend fails

Failure of libxl_domain_suspend() does not leave the domain in
a suspended state, so no need to call libxl_domain_resume(),
which btw will fail with "domain not suspended".

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 15120b8c61014a9263cb53314076da9a44e39621)

9 years agolibxl: fix ref counting of libxlMigrationDstArgs
Jim Fehlig [Wed, 15 Jul 2015 22:35:50 +0000 (16:35 -0600)] 
libxl: fix ref counting of libxlMigrationDstArgs

This patch fixes some flawed logic around ref counting the
libxlMigrationDstArgs object.

First, when adding sockets to the event loop with
virNetSocketAddIOCallback(), the generic virObjectFreeCallback()
was registered as a free function, with libxlMigrationDstArgs as
its parameter. A reference was also taken on
libxlMigrationDstArgs for each successful call to
virNetSocketAddIOCallback(). The rational behind this logic was
that the libxlMigrationDstArgs object had to out-live the socket
objects. But virNetSocketAddIOCallback() already takes a
reference on socket objects, ensuring their life until removed
from the event loop and unref'ed in virNetSocketEventFree(). We
only need to ensure libxlMigrationDstArgs lives until
libxlDoMigrateReceive() finishes, which can be done by simply
unref'ing libxlMigrationDstArgs at the end of
libxlDoMigrateReceive().

The second flaw was unref'ing the sockets in the failure path of
libxlMigrateReceive() and at the end of libxlDoMigrateReceive().
As mentioned above, the sockets are already unref'ed by
virNetSocketEventFree() when removed from the event loop.
Attempting to unref the socket a second time resulted in a
libvirtd crash since the socket was previously unref'ed and
disposed.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 44a54eb073d2ae52ebf1661ae73bb1f0f98599f9)

9 years agolibvirt_lxc: Claim success for --help
Michal Privoznik [Thu, 27 Aug 2015 00:21:54 +0000 (02:21 +0200)] 
libvirt_lxc: Claim success for --help

So far, if libvirt_lxc binary (usually to be found under
/usr/libexec/) is run with --help, due to a missing line
and our usual functions pattern, an 'uknown' error is returned.
Yeah, the help is printed out, but we should not claim error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit fb0ef0d5110dd737bde2b79e17c12b71a69f5d06)

9 years agovirt-aa-helper: Improve valid_path
Michal Privoznik [Thu, 27 Aug 2015 00:50:21 +0000 (02:50 +0200)] 
virt-aa-helper: Improve valid_path

So, after some movement in virt-aa-helper, I've noticed the
virt-aa-helper-test failing. I've ran gdb (it took me a while to
realize how to do that) and this showed up immediately:

  Program received signal SIGSEGV, Segmentation fault.
  strlen () at ../sysdeps/x86_64/strlen.S:106
  106     ../sysdeps/x86_64/strlen.S: No such file or directory.
  (gdb) bt
  #0  strlen () at ../sysdeps/x86_64/strlen.S:106
  #1  0x0000555555561a13 in array_starts_with (str=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", arr=0x7fffffffd160, size=-1540438016) at security/virt-aa-helper.c:525
  #2  0x0000555555561d49 in valid_path (path=0x5555557ce910 "/tmp/tmp.6nI2Fkv0KL/1.img", readonly=false) at security/virt-aa-helper.c:617
  #3  0x0000555555562506 in vah_add_path (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw", recursive=false) at security/virt-aa-helper.c:823
  #4  0x0000555555562693 in vah_add_file (buf=0x7fffffffd3e0, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", perms=0x555555581585 "rw") at security/virt-aa-helper.c:854
  #5  0x0000555555562918 in add_file_path (disk=0x5555557d4440, path=0x5555557cb910 "/tmp/tmp.6nI2Fkv0KL/1.img", depth=0, opaque=0x7fffffffd3e0) at security/virt-aa-helper.c:931
  #6  0x00007ffff78f18b1 in virDomainDiskDefForeachPath (disk=0x5555557d4440, ignoreOpenFailure=true, iter=0x5555555628a6 <add_file_path>, opaque=0x7fffffffd3e0) at conf/domain_conf.c:23286
  #7  0x0000555555562b5f in get_files (ctl=0x7fffffffd670) at security/virt-aa-helper.c:982
  #8  0x0000555555564100 in vahParseArgv (ctl=0x7fffffffd670, argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1277
  #9  0x00005555555643d6 in main (argc=5, argv=0x7fffffffd7e8) at security/virt-aa-helper.c:1332

So I've taken look at valid_path() because it is obviously
calling array_starts_with() with malformed @size. And here's the
result: there are two variables to hold the size of three arrays
and their value is recalculated before each call of
array_starts_with(). What if we just use three variables,
initialize them and do not touch them afterwards?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 52970dec5b4d0fd1a9baa593b46a33bd7eeaf6b8)

9 years agoqemu: Emit correct audit message for memory hot unplug
Luyao Huang [Thu, 13 Aug 2015 14:15:28 +0000 (22:15 +0800)] 
qemu: Emit correct audit message for memory hot unplug

https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3

If the qemu monitor fails to remove the memory from the guest for
any reason, the auditlog message will incorrectly use the current
actual memory (via virDomainDefGetMemoryActual) instead of the
value we were attempting to reduce to. The result is the 'new-mem'
and 'old-mem' values for the auditlog message would be identical.

This patch creates a local 'newmem' which accounts for the current
memory size minus the memory which is being removed. NB, for the
success case this results in the same value that would be returned
by virDomainDefGetMemoryActual without the need to do the math. This
follows the existing code which would subtract the size for cur_balloon.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit 8f8031df1998725ac34a9a3138705c4f7cdf0488)

9 years agoqemu: Emit correct audit message for memory hot plug
Luyao Huang [Thu, 13 Aug 2015 14:15:27 +0000 (22:15 +0800)] 
qemu: Emit correct audit message for memory hot plug

https://bugzilla.redhat.com/show_bug.cgi?id=1226234#c3

Prior to this patch, after successfully hot plugging memory
the audit log indicated that the update failed, e.g.:

type=VIRT_RESOURCE ... old-mem=1024000 new-mem=1548288 \
exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=pts/2 res=failed

This patch will adjust where virDomainAuditMemory is called to
ensure the proper 'ret' value is used based on success or failure.

Additionally, the audit message should include the size of the
memory we were attempting to change to rather than the current
actual size. On failure to add, the message showed the same value
for old-mem and new-mem.

In order to do this, introduce a 'newmem' local which will compute
the new size based on the oldmem size plus the size of memory we
are about to add. NB: This would be the same as calling the
virDomainDefGetMemoryActual again on success, but avoids the
overhead of recalculating. Plus cur_balloon is already adjusted
by the same value, so this follows that.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit cb1fbda4a1b23581ed9e305a48b0376633d5ff4a)

9 years agohostdev: skip ACS check when using VFIO for device assignment
Laine Stump [Wed, 26 Aug 2015 06:04:23 +0000 (02:04 -0400)] 
hostdev: skip ACS check when using VFIO for device assignment

The ACS checks are meaningless when using the more modern VFIO driver
for device assignment since VFIO has its own more complete and exact
checks, but I didn't realize that when I added support for VFIO. This
patch eliminates the ACS check when preparing PCI devices for
assignment if VFIO is being used.

This resolves:

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

(cherry picked from commit 108d591b1144bc6cb5d1199f6fc23ee972b76e86)

9 years agoStart daemon only after filesystems are mounted
Martin Kletzander [Tue, 25 Aug 2015 15:07:46 +0000 (17:07 +0200)] 
Start daemon only after filesystems are mounted

When images are on mounted filesystems, there is no guarantee libvirtd
will start before they are mounted.  Since we want to start after both
local and remote filesystems are mounted, we need to add both local-fs
and remote-fs as targets that should precede starting libvirtd service.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3418e7815a9fc9245aa6476415a353790ed3cb8b)

9 years agovirt-aa-helper: add NVRAM store file for read/write
Peter Kieser [Thu, 20 Aug 2015 17:58:59 +0000 (10:58 -0700)] 
virt-aa-helper: add NVRAM store file for read/write

This is a cryptographically signed message in MIME format.

Some UEFI firmwares may want to use a non-volatile memory to store some
variables.
If AppArmor is enabled, and NVRAM store file is set currently
virt-aa-helper does
not add the NVRAM store file to the template. Add this file for
read/write when
this functionality is defined in domain XML.

Signed-off-by: Peter Kieser <peter@kieser.ca>
(cherry picked from commit 91fdcefa7f145c1c39acc8e9a44fbfbf11568e54)

9 years agoqemu: Update blkio.weight value after successful set
Luyao Huang [Wed, 19 Aug 2015 03:56:33 +0000 (11:56 +0800)] 
qemu: Update blkio.weight value after successful set

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

Make a call virCgroupGetBlkioWeight to re-read blkio.weight right
after it is set in order to keep internal data up-to-date.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit bf2788218ad29719467260aa4ecad6dc31c97046)

9 years agoEliminate incorrect and unnecessary check for changed IP address
Vasiliy Tolstov [Sat, 22 Aug 2015 15:33:15 +0000 (15:33 +0000)] 
Eliminate incorrect and unnecessary check for changed IP address

Commit aa2cc7 modified a previously unnecessary but innocuous check
for interface IP address during interface update incorrectly, causing
all attempted updates (e.g. changing link state) to interfaces of
type='ethernet' for QEMU to fail.

This patch fixes the issue by completely removing the check for IP
address, which is pointless since QEMU doesn't support setting
interface IP addresses from the domain interface XML anyway.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Laine Stump <laine@laine.org>
(cherry picked from commit bbc705d1309b8ec2eb4cdae011dc702802c96d11)

9 years agovirt-aa-helper: allow access to /usr/share/ovmf/
intrigeri [Fri, 21 Aug 2015 08:52:52 +0000 (10:52 +0200)] 
virt-aa-helper: allow access to /usr/share/ovmf/

We forbid access to /usr/share/, but (at least on Debian-based systems)
the Open Virtual Machine Firmware files needed for booting UEFI virtual
machines in QEMU live in /usr/share/ovmf/. Therefore, we need to add
that directory to the list of read only paths.

A similar patch was suggested by Jamie Strandboge <jamie@canonical.com>
on https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1483071.

(cherry picked from commit 2f01cfdf05448513d150ff1914d3444161c531b9)

9 years agovirt-aa-helper: Simplify restriction logic
Guido Günther [Fri, 21 Aug 2015 08:49:15 +0000 (10:49 +0200)] 
virt-aa-helper: Simplify restriction logic

First check overrides, then read only files then restricted access
itself.

This allows us to mark files for read only access whose parents were
already restricted for read write.

Based on a proposal by Martin Kletzander

(cherry picked from commit d25a5e087ae10142d3d533ed193146736526b2ae)

9 years agovirt-aa-helper: document --probing and --dry-run
Guido Günther [Fri, 21 Aug 2015 10:29:25 +0000 (12:29 +0200)] 
virt-aa-helper: document --probing and --dry-run

(cherry picked from commit 26c5fa3a9bd37624ddd1509daf7d6a84268f089e)

9 years agoAdd generated libvirt_admin.syms into .gitignore
Martin Kletzander [Thu, 20 Aug 2015 18:03:12 +0000 (11:03 -0700)] 
Add generated libvirt_admin.syms into .gitignore

Commit a2c5d16a70a6161449c687be74db2813b362cf5e switched to generating
libvirt_admin.syms, but forgot to add the generated file into
.gitignore, hence causing tree pollution post-build.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 14d84db863c9d14844e2f0ac22dbc679c1c04fe4)

9 years agolibvirt-admin: Generate symbols file
Guido Günther [Wed, 19 Aug 2015 08:38:31 +0000 (10:38 +0200)] 
libvirt-admin: Generate symbols file

Since we're linking this into libvirtd we need some symbols to be public
but not part of the public API so mark them as
LIBVIRT_ADMIN_PRIVATE_<VERSION> as we do with libvirt.

Making all other symbols local makes sure we don't accidentally leak
unwanted ones.

(cherry picked from commit a2c5d16a70a6161449c687be74db2813b362cf5e)

9 years agodaemon: Use $(NULL) for libvird_admin's flags
Guido Günther [Wed, 19 Aug 2015 08:27:25 +0000 (10:27 +0200)] 
daemon: Use $(NULL) for libvird_admin's flags

This makes it consistent with the other FLAGS in this file and reduced
clutter in the diff when adding new entries.

(cherry picked from commit 6d71d548125bac8b445dee0734c706b7cc22cd11)

9 years agoqemu: Add check for invalid iothread_id in qemuDomainChgIOThread
John Ferlan [Thu, 13 Aug 2015 13:19:01 +0000 (09:19 -0400)] 
qemu: Add check for invalid iothread_id in qemuDomainChgIOThread

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

Since iothread_id == 0 is an invalid value for QEMU let's point
that out specifically.  For the IOThreadDel code, the failure would
have ended up being a failure to find the IOThread ID; however, for
the IOThreadAdd code - an IOThread 0 was added and that isn't good.

It seems during many reviews/edits to the code the check for
iothread_id = 0 being invalid was lost - it could have originally
been in the API code, but requested to be moved - I cannot remember.

(cherry picked from commit 32c6b1908bbf8a1aa4a2692135e7d02a166a0317)

9 years agovirsh: Reset global error after successfull domain lookup
Luyao Huang [Mon, 17 Aug 2015 09:56:48 +0000 (17:56 +0800)] 
virsh: Reset global error after successfull domain lookup

When looking up a domain, we try to look up by ID, UUID and NAME
consequently while not really caring which of those lookups succeeds.
The problem is that if any of them fails, we dispatch the error from the
driver and that means setting both threadlocal and global error. Let's
say the last lookup (by NAME) succeeds and resets the threadlocal error as any
other API does, however leaving the global error unchanged. If the underlying
virsh command does not succeed afterwards, our cleanup routine in
vshCommandRun ensures that no libvirt error will be forgotten and that's
exactly where this global error comes in incorrectly.

 # virsh domif-setlink 123 vnet1 up
 error: interface (target: vnet1) not found
 error: Domain not found: no domain with matching id 123

This patch also resets the global error which would otherwise cause some
minor confusion in reported error messages.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
(cherry picked from commit 70f56dd72cdca309005c8234a8945721badbcfff)

9 years agobuild: fix mingw build
Eric Blake [Mon, 17 Aug 2015 23:03:40 +0000 (16:03 -0700)] 
build: fix mingw build

Ever since commit e44b0269, 64-bit mingw compilation fails with:

../../src/util/virprocess.c: In function 'virProcessGetPids':
../../src/util/virprocess.c:628:50: error: passing argument 4 of 'virStrToLong_i' from incompatible pointer type [-Werror=incompatible-pointer-types]
         if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0)
                                                  ^
In file included from ../../src/util/virprocess.c:59:0:
../../src/util/virstring.h:53:5: note: expected 'int *' but argument is of type 'pid_t * {aka long long int *}'
 int virStrToLong_i(char const *s,
     ^
cc1: all warnings being treated as errors

Although mingw won't be using this function, it does compile the
file, and the fix is relatively simple.

* src/util/virprocess.c (virProcessGetPids): Don't assume pid_t
fits in int.

Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 0a617b53d4e03658b3562cc04adff54eaf2eb925)

9 years agoDetect location of qemu-bridge-helper
Guido Günther [Thu, 13 Aug 2015 10:20:29 +0000 (12:20 +0200)] 
Detect location of qemu-bridge-helper

RedHat and Debian based distros use different locations

Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790935
(cherry picked from commit 0e4972fe48aeaade393daf089013092a2ecde4b3)

9 years agoCheck if qemu-bridge-helper exists and is executable
Guido Günther [Thu, 13 Aug 2015 12:19:50 +0000 (14:19 +0200)] 
Check if qemu-bridge-helper exists and is executable

Otherwise the error is just

    error: Failed to create domain from test1.xml
    error: failed to retrieve file descriptor for interface: Transport endpoint is not connected

since we don't get a sensible error after the fork.

(cherry picked from commit 151ba022939dad1e562c4156cb62e7a3ade6a7f5)

9 years agoqemu: Use numad information when getting pin information
Martin Kletzander [Sun, 26 Jul 2015 16:49:02 +0000 (18:49 +0200)] 
qemu: Use numad information when getting pin information

Pinning information returned for emulatorpin and vcpupin calls is being
returned from our data without querying cgroups for some time.  However,
not all the data were utilized.  When automatic placement is used the
information is not returned for the calls mentioned above.  Since the
numad hint in private data is properly saved/restored, we can safely use
it to return true information.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 776924e37649f2d47acd805746d5fd9325212ea5)

9 years agoqemu: Keep numad hint after daemon restart
Martin Kletzander [Fri, 24 Jul 2015 14:06:33 +0000 (16:06 +0200)] 
qemu: Keep numad hint after daemon restart

The numad hint stored in priv->autoNodeset is information that gets lost
during daemon restart.  And because we would like to use that
information in the future, we also need to save it in the status XML.
For the sake of tests, we need to initialize nnumaCell_max to some
value, so that the restoration doesn't fail in our test suite.  There is
no need to fill in the actual numa cell data since the recalculating
function virCapabilitiesGetCpusForNodemask() will not fail, it will just
skip filling the data in the bitmap which we don't use in tests anyway.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 8ce86722d78d8b2a1e7d9cb29571beb791c9f3d7)

9 years agoconf: Pass private data to Parse function of XML options
Martin Kletzander [Fri, 24 Jul 2015 17:35:00 +0000 (19:35 +0200)] 
conf: Pass private data to Parse function of XML options

This needs a reorder of XML option definitions.  It might come in handy
one day.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 7c8028cda95c3af388f7485e682ed07629bb9e7a)

9 years agoqemu: Fix segfault when parsing private domain data
Martin Kletzander [Thu, 13 Aug 2015 08:03:12 +0000 (10:03 +0200)] 
qemu: Fix segfault when parsing private domain data

When parsing private domain data, there are two paths that are flawed.
They are both error paths, just from different parts of the function.
One of them can call free() on an uninitialized pointer.  Initialization
to NULL is enough here.  The other one is a bit trickier to explain, but
as easy as the first one to fix.  We create capabilities, parse them and
then assign them into the private data pointer inside the domain object.
If, however, we get to fail from now on, the error path calls unrefs the
capabilities and then, when the domain object is being cleaned,
qemuDomainObjPrivateFree() tries to unref them as well.  That causes a
segfault.  Settin the pointer to NULL upon successful addition to the
private data is enough.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 92ddffdbd3c91d99f8f7ed9b661388a2c5d36cc2)

9 years agodomain: Fix crash if trying to live update disk <serial>
Cole Robinson [Mon, 10 Aug 2015 23:01:43 +0000 (19:01 -0400)] 
domain: Fix crash if trying to live update disk <serial>

If you pass <disk><serial> XML to UpdateDevice, and the original device
didn't have a <serial> block, libvirtd crashes trying to read the original
NULL serial string.

Use _NULLABLE string comparisons to avoid the crash. A couple other
properties needed the change too.

(cherry picked from commit c7790408d7e16b1ad00a690433d9310f104994f7)

9 years agovirNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable
Guido Günther [Tue, 11 Aug 2015 09:49:18 +0000 (11:49 +0200)] 
virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable

When running the test suite using "unshare -n" we might have IPv6 but no
configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
EAI_NONAME which we should then treat as IPv6 unavailable.

(cherry picked from commit fbb27088eec1b54fcd5a0950b11c31d27a2598d4)

9 years agoutil: don't overwrite stack when getting ethtool gfeatures
Laine Stump [Tue, 11 Aug 2015 17:45:46 +0000 (13:45 -0400)] 
util: don't overwrite stack when getting ethtool gfeatures

This fixes the crash described here:

 https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html

In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
object that was a local on the stack, resulting in the memory past the
end of the object being overwritten. This was because the struct used
by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
array, but we were telling ethtool that it could use 2 elements on the
array.

The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
including the extra length needed for a 2 element array at the end.

(cherry picked from commit bfaaa2b681018f3705bae17c001700a03f67d7c4)

9 years agoconf: Don't try formating non-existing addresses
Martin Kletzander [Tue, 11 Aug 2015 13:09:29 +0000 (15:09 +0200)] 
conf: Don't try formating non-existing addresses

Commit a6f9af8292b6 added checking for address colisions between
starting and ending addresses of forwarding addresses, but forgot that
there might be no addresses set at all.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 1f24c1494a85d663fa36047922a7974a292a46a7)

9 years agoadmin: Drop 'internal.h' include from libvirt-admin.h
Erik Skultety [Mon, 10 Aug 2015 12:02:32 +0000 (14:02 +0200)] 
admin: Drop 'internal.h' include from libvirt-admin.h

This is a public library, it shouldn't include anything that is
internal. Including the library in it's current state to an example
application fails the preprocessor phase.

(cherry picked from commit eefec56b478e53f06c389ee75a21066b17606163)

9 years agoqemu: fail on attempts to use <filterref> for non-tap network connections
Laine Stump [Mon, 10 Aug 2015 06:05:29 +0000 (02:05 -0400)] 
qemu: fail on attempts to use <filterref> for non-tap network connections

nwfilter uses iptables and ebtables, which only work properly on
tap-based network connections (*not* on macvtap, for example), but we
just ignore any <filterref> elements for other types of networks,
potentially giving users a false sense of security.

This patch checks the network type and fails/logs an error if any
domain <interface> has a <filterref> when the connection isn't using a
tap device.

This resolves:

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

(cherry picked from commit f4f1d18dc464a4fd436ce9cdd18d6f06fa7494e5)

9 years agonetwork: validate network NAT range
Laine Stump [Sat, 8 Aug 2015 21:46:41 +0000 (17:46 -0400)] 
network: validate network NAT range

This patch modifies virSocketAddrGetRange() to function properly when
the containing network/prefix of the address range isn't known, for
example in the case of the NAT range of a virtual network (since it is
a range of addresses on the *host*, not within the network itself). We
then take advantage of this new functionality to validate the NAT
range of a virtual network.

Extra test cases are also added to verify that virSocketAddrGetRange()
works properly in both positive and negative cases when the network
pointer is NULL.

This is the *real* fix for:

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

Commits 1e334a and 48e8b9 had earlier been pushed as fixes for that
bug, but I had neglected to read the report carefully, so instead of
fixing validation for the NAT range, I had fixed validation for the
DHCP range. sigh.

(cherry picked from commit a6f9af8292b6462e509892b3a16acbcaaef61e4e)

9 years agovirNetDevBandwidthParseRate: Reject negative values
Michal Privoznik [Fri, 7 Aug 2015 15:03:12 +0000 (17:03 +0200)] 
virNetDevBandwidthParseRate: Reject negative values

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

The following XML really does not make any sense:

<inbound average="-1" burst="-2" peak="-3" floor="-4"/>

There can't be a negative packet rate. Well, so far we haven't
assigned any meaning to it. So reject it unless users harm themselves,
because otherwise we turn the negative numbers into really big values.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 2a5d3f227df7be78449792103e0101a4b859c49b)

9 years agonetwork: verify proper address family in updates to <host> and <range>
Laine Stump [Mon, 19 Jan 2015 22:04:01 +0000 (17:04 -0500)] 
network: verify proper address family in updates to <host> and <range>

By specifying parentIndex in a call to virNetworkUpdate(), it was
possible to direct libvirt to add a dhcp range or static host of a
non-matching address family to the <dhcp> element of an <ip>. For
example, given:

 <ip address='192.168.122.1' netmask='255.255.255.0'/>
 <ip family='ipv6' address='2001:db6:ca3:45::1' prefix='64'/>

you could provide a static host entry with an IPv4 address, and
specify that it be added to the 2nd <ip> element (index 1):

  virsh net-update default add ip-dhcp-host --parent-index 1 \
  '<host mac="52:54:00:00:00:01" ip="192.168.122.45"/>'

This would be happily added with no error (and no concern of any
possible future consequences).

This patch checks that any dhcp range or host element being added to a
network ip's <dhcp> subelement has addresses of the same family as the
ip element they are being added to.

This resolves:

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

(cherry picked from commit 6a21bc119e37bafcbe5cfd13e57080d651296b43)

9 years agoconf: more useful error message when pci function is out of range
Laine Stump [Wed, 22 Jul 2015 15:59:00 +0000 (11:59 -0400)] 
conf: more useful error message when pci function is out of range

If a pci address had a function number out of range, the error message
would be:

  Insufficient specification for PCI address

which is logged by virDevicePCIAddressParseXML() after
virDevicePCIAddressIsValid returns a failure.

This patch enhances virDevicePCIAddressIsValid() to optionally report
the error itself (since it is the place that decides which part of the
address is "invalid"), and uses that feature when calling from
virDevicePCIAddressParseXML(), so that the error will be more useful,
e.g.:

  Invalid PCI address function=0x8, must be <= 7

Previously, virDevicePCIAddressIsValid didn't check for the
theoretical limits of domain or bus, only for slot or function. While
adding log messages, we also correct that ommission. (The RNG for PCI
addresses already enforces this limit, which by the way means that we
can't add any negative tests for this - as far as I know our
domainschematest has no provisions for passing XML that is supposed to
fail).

Note that virDevicePCIAddressIsValid() can only check against the
absolute maximum attribute values for *any* possible PCI controller,
not for the actual maximums of the specific controller that this
device is attaching to; fortunately there is later more specific
validation for guest-side PCI addresses when building the set of
assigned PCI addresses. For host-side PCI addresses (e.g. for
<hostdev> and for network device pools), we rely on the error that
will be logged when it is found that the device doesn't actually
exist.

This resolves:

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

(cherry picked from commit f8fe8f03455783afcd62d79db7ce4120f514c629)

9 years agovirDomainDefParseXML: Check for malicious cpu ids in <numa/>
Michal Privoznik [Fri, 7 Aug 2015 14:36:38 +0000 (16:36 +0200)] 
virDomainDefParseXML: Check for malicious cpu ids in <numa/>

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

Some users think this is a good idea:

      <vcpu placement='static'>4</vcpu>
      <cpu mode='host-model'>
        <model fallback='allow'/>
        <numa>
          <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
          <cell id='1' cpus='9-10' memory='2097152' unit='KiB'/>
        </numa>
      </cpu>

It's not. Lets therefore introduce a check and discourage them in
doing so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 82af954c527e88111b05d50953b80eb4afde4d9a)

9 years agonuma_conf: Introduce virDomainNumaGetMaxCPUID
Michal Privoznik [Fri, 7 Aug 2015 14:31:57 +0000 (16:31 +0200)] 
numa_conf: Introduce virDomainNumaGetMaxCPUID

This function should return the greatest CPU number set in
/domain/cpu/numa/cell/@cpus. The idea is that we should compare
the returned value against /domain/vcpu value. Yes, there exist
users who think the following is a good idea:

  <vcpu placement='static'>4</vcpu>
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <numa>
      <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
      <cell id='1' cpus='9-10' memory='2097152' unit='KiB'/>
    </numa>
  </cpu>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8f2535dec1fdd969e86aa39c8a2583c723341733)

9 years agoAllow vfio hotplug of a device to the domain which owns the iommu
Shivaprasad G Bhat [Tue, 14 Jul 2015 11:56:33 +0000 (17:26 +0530)] 
Allow vfio hotplug of a device to the domain which owns the iommu

The commit 7e72de4 didn't consider the hotplug scenarios. The patch addresses
the hotplug case whereby if atleast one of the pci function is owned by a
guest, the hotplug of other functions/devices in the same iommu group to the
same guest goes through successfully.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
(cherry picked from commit e3810db34f1acb74dfcfd69219930e23a30284f6)

9 years agoqemu: Forbid image pre-creation for non-shared storage migration
Peter Krempa [Tue, 4 Aug 2015 08:12:30 +0000 (10:12 +0200)] 
qemu: Forbid image pre-creation for non-shared storage migration

Libvirt doesn't reliably know the location of the backing chain when
pre-creating images for non-shared migration. This isn't a problem for
full copy, but incremental copy requires the information.

Forbid pre-creating the image in cases where incremental migration is
required. This limitation can perhaps be lifted once libvirt will fully
support loading of backing chain information from the XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1249587
(cherry picked from commit 6da3b694cca436fcc38247aff9d1ce8e955292a8)

9 years agovirsh: fix domfsinfo output in quiet mode
Luyao Huang [Wed, 5 Aug 2015 03:17:22 +0000 (11:17 +0800)] 
virsh: fix domfsinfo output in quiet mode

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

When run domfsinfo in quiet mode, we cannot get any
useful information (just get \n), this is because
we didn't use vshPrint to print useful information.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit ee6160b549568133d904aa27a553d66f0b0c01d3)

9 years agotests: extend workaround for gnutls private key loading failure
Daniel P. Berrange [Tue, 4 Aug 2015 11:26:15 +0000 (12:26 +0100)] 
tests: extend workaround for gnutls private key loading failure

In gnutls 3.4.3 there is a regression in the loading of private
keys via gnutls_x509_privkey_import. We already have a workaround
to deal with failures on older gnutls, but the error code that
the new gnutls returns is different. Extend the workaround so that
is checks for GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE too.

See also gnutls https://bugzilla.redhat.com/show_bug.cgi?id=1250020

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

9 years agoqemu: fix some api cannot work when disable cpuset in conf
Luyao Huang [Mon, 20 Jul 2015 09:18:37 +0000 (17:18 +0800)] 
qemu: fix some api cannot work when disable cpuset in conf

If cpuset is disabled or not available, it libvirt must not use it.
Mainly for actions that do not need it and can use sched_setaffinity()
or numa_membind() instead, because they will fail without good reason.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit 1439eb32afc9f97378d1d121c0b5c80d2f84896c)

9 years agostorage: only run safezero if allocation is > 0
Guido Günther [Sun, 23 Aug 2015 20:03:54 +0000 (22:03 +0200)] 
storage: only run safezero if allocation is > 0

While a zero allocation in safezero should be fine it isn't when we use
posix_fallocate which returns EINVAL on a zero allocation.

While we could skip the zero allocation in safezero_posix_fallocate it's
an optimization to do it for all allocations.

This fixes vm installation via virtinst for me which otherwise aborts
like:

   Starting install...
   Retrieving file linux...               | 5.9 MB     00:01 ...
   Retrieving file initrd.gz...           |  29 MB     00:07 ...
   ERROR    Couldn't create storage volume 'virtinst-linux.sBgds4': 'cannot fill file '/var/lib/libvirt/boot/virtinst-linux.sBgds4': Invalid argument'

The error was introduced by e30297b0 as spotted by Chunyan Liu

(cherry picked from commit 269d39afe5c59ecb3d3d64dba52f8cfa8d63d197)

9 years agoqemu: command: Report stderr from qemu-bridge-helper
Cole Robinson [Thu, 10 Sep 2015 16:35:00 +0000 (12:35 -0400)] 
qemu: command: Report stderr from qemu-bridge-helper

There's a couple reports of things failing in this area (bug 1259070),
but it's tough to tell what's going wrong without stderr from
qemu-bridge-helper. So let's report stderr in the error message

Couple new examples:

virbr0 is inactive:
internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=virbr0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=failed to get mtu of bridge `virbr0': No such device

bridge isn't on the ACL:
internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=br0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=access denied by acl file

(cherry picked from commit db35beaa1d276cc229dcbbc8460ce2fccdda5084)

9 years agoqemu: Fix reporting of physical capacity for block devices
Peter Krempa [Fri, 7 Aug 2015 09:01:49 +0000 (11:01 +0200)] 
qemu: Fix reporting of physical capacity for block devices

Qemu reports physical size 0 for block devices. As 15fa84acbb55ebfee6a4
changed the behavior of qemuDomainGetBlockInfo to just query the monitor
this created a regression since we didn't report the size correctly any
more.

This patch adds code to refresh the physical size of a block device by
opening it and seeking to the end and uses it both in
qemuDomainGetBlockInfo and also in qemuDomainGetStatsOneBlock that was
broken since it was introduced in this respect.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250982
(cherry picked from commit 8dc27259255b79758367789ed272e909bdb56735)

9 years agoremoteClientCloseFunc: Don't mangle connection object refcount
Michal Privoznik [Thu, 3 Sep 2015 10:11:53 +0000 (12:11 +0200)] 
remoteClientCloseFunc: Don't mangle connection object refcount

Well, in 8ad126e6 we tried to fix a memory corruption problem.
However, the fix was not as good as it could be. I mean, the
commit has one line more than it should. I've noticed this output
just recently:

  # ./run valgrind --leak-check=full --show-reachable=yes ./tools/virsh domblklist gentoo
  ==17019== Memcheck, a memory error detector
  ==17019== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  ==17019== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
  ==17019== Command: /home/zippy/work/libvirt/libvirt.git/tools/.libs/virsh domblklist gentoo
  ==17019==
  Target     Source
  ------------------------------------------------
  fda        /var/lib/libvirt/images/fd.img
  vda        /var/lib/libvirt/images/gentoo.qcow2
  hdc        /home/zippy/tmp/install-amd64-minimal-20150402.iso

  ==17019== Thread 2:
  ==17019== Invalid read of size 4
  ==17019==    at 0x4EFF5B4: virObjectUnref (virobject.c:258)
  ==17019==    by 0x5038CFF: remoteClientCloseFunc (remote_driver.c:552)
  ==17019==    by 0x5069D57: virNetClientCloseLocked (virnetclient.c:685)
  ==17019==    by 0x506C848: virNetClientIncomingEvent (virnetclient.c:1852)
  ==17019==    by 0x5082136: virNetSocketEventHandle (virnetsocket.c:1913)
  ==17019==    by 0x4ECD64E: virEventPollDispatchHandles (vireventpoll.c:509)
  ==17019==    by 0x4ECDE02: virEventPollRunOnce (vireventpoll.c:658)
  ==17019==    by 0x4ECBF00: virEventRunDefaultImpl (virevent.c:308)
  ==17019==    by 0x130386: vshEventLoop (vsh.c:1864)
  ==17019==    by 0x4F1EB07: virThreadHelper (virthread.c:206)
  ==17019==    by 0xA8462D3: start_thread (in /lib64/libpthread-2.20.so)
  ==17019==    by 0xAB441FC: clone (in /lib64/libc-2.20.so)
  ==17019==  Address 0x139023f4 is 4 bytes inside a block of size 240 free'd
  ==17019==    at 0x4C2B1F0: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==17019==    by 0x4EA8949: virFree (viralloc.c:582)
  ==17019==    by 0x4EFF6D0: virObjectUnref (virobject.c:273)
  ==17019==    by 0x4FE74D6: virConnectClose (libvirt.c:1390)
  ==17019==    by 0x13342A: virshDeinit (virsh.c:406)
  ==17019==    by 0x134A37: main (virsh.c:950)

The problem is, when registering remoteClientCloseFunc(), it's
conn->closeCallback which is ref'd. But in the function itself
it's conn->closeCallback->conn what is unref'd. This is causing
imbalance in reference counting. Moreover, there's no need for
the remote driver to increase/decrease conn refcount since it's
not used anywhere. It's just merely passed to client registered
callback. And for that purpose it's correctly ref'd in
virConnectRegisterCloseCallback() and then unref'd in
virConnectUnregisterCloseCallback().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit e68930077034f786e219bdb015f8880dbc5a246f)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agostorage: Correct the 'mode' check
John Ferlan [Mon, 24 Aug 2015 16:48:40 +0000 (12:48 -0400)] 
storage: Correct the 'mode' check

Commit id '7c2d65dde2' changed the default value of mode to be -1 if not
supplied in the XML, which should cause creation of the volume using the
default mode of VIR_STORAGE_DEFAULT_VOL_PERM_MODE; however, the check
made was whether mode was '0' or not to use default or provided value.

This patch fixes the issue to check if the 'mode' was provided in the XML
and use that value.

(cherry picked from commit 691dd388aee99f8b06177540303b690586d5f5b3)

9 years agostorage: Handle failure from refreshVol
John Ferlan [Mon, 24 Aug 2015 16:38:13 +0000 (12:38 -0400)] 
storage: Handle failure from refreshVol

Commit id '155ca616' added the 'refreshVol' API. In an NFS root-squash
environment it was possible that if the just created volume from XML wasn't
properly created with the right uid/gid and/or mode, then the followup
refreshVol will fail to open the volume in order to get the allocation/
capacity values. This would leave the volume still on the server and
cause a libvirtd crash because 'voldef' would be in the pool list, but
the cleanup code would free it.

(cherry picked from commit db9277a39bc364806e8d3e08a08fc128d59b7094)

9 years agovirfile: Introduce virFileUnlink
John Ferlan [Mon, 24 Aug 2015 21:00:02 +0000 (17:00 -0400)] 
virfile: Introduce virFileUnlink

In an NFS root-squashed environment the 'vol-delete' command will fail to
'unlink' the target volume since it was created under a different uid:gid.

This code continues the concepts introduced in virFileOpenForked and
virDirCreate[NoFork] with respect to running the unlink command under
the uid/gid of the child. Unlike the other two, don't retry on EACCES
(that's why we're here doing this now).

(cherry picked from commit 35847860f65f92e444db9730e00cdaef45198e0c)

9 years agoRevert "LXC: show used memory as 0 when domain is not active"
Jim Fehlig [Mon, 10 Aug 2015 18:49:55 +0000 (12:49 -0600)] 
Revert "LXC: show used memory as 0 when domain is not active"

This reverts commit 1ce7c1d20cfd5afb26d2dbc88201085d52415d0e,
which introduced a significant semantic change to the
virDomainGetInfo() API. Additionally, the change was only
made to 2 of the 15 virt drivers.

Conflicts:
src/qemu/qemu_driver.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 60acb38abbee1636a9cddf8d296f700d115c8f77)

10 years agoRelease of libvirt-1.2.18 v1.2.18
Daniel Veillard [Mon, 3 Aug 2015 09:36:39 +0000 (17:36 +0800)] 
Release of libvirt-1.2.18

* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated

10 years agoqemu: Do not reset labels when migration fails
Jiri Denemark [Thu, 30 Jul 2015 14:42:43 +0000 (16:42 +0200)] 
qemu: Do not reset labels when migration fails

When stopping a domain on the destination host after a failed migration,
we need to avoid reseting security labels since the domain is still
running on the source host. While we were correctly doing so in some
cases, there were still some paths which did this wrong.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Properly check for incoming migration job
Jiri Denemark [Thu, 30 Jul 2015 13:53:41 +0000 (15:53 +0200)] 
qemu: Properly check for incoming migration job

In addition to checking the current asynchronous job
qemuMigrationJobIsActive reports an error if the current job does not
match the one we asked for. Let's just check the job directly since we
are not interested in the error in qemuProcessHandleMonitorEOF.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Reject migration with memory-hotplug if destination doesn't support it
Peter Krempa [Thu, 30 Jul 2015 13:27:07 +0000 (15:27 +0200)] 
qemu: Reject migration with memory-hotplug if destination doesn't support it

If destination libvirt doesn't support memory hotplug since all the
support was introduced by adding new elements the destination would
attempt to start qemu with an invalid configuration. The worse part is
that qemu might hang in such situation.

Fix this by sending a required migration feature called 'memory-hotplug'
to the destination. If the destination doesn't recognize it it will fail
the migration.

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

10 years agoFix syntax-check: missing "%s" v1.2.18-rc2
Cédric Bosdonnat [Thu, 30 Jul 2015 09:10:48 +0000 (11:10 +0200)] 
Fix syntax-check: missing "%s"

10 years agoLoad nbd module before running qemu-nbd
Cédric Bosdonnat [Mon, 20 Jul 2015 12:37:48 +0000 (14:37 +0200)] 
Load nbd module before running qemu-nbd

So far qemu-nbd is run even if the nbd kernel module isn't loaded. This
leads to errors when the user starts his lxc container while libvirt
could easily load the nbd module automatically.

10 years agoqemu: Adjust VM id allocation
Erik Skultety [Tue, 28 Jul 2015 15:33:53 +0000 (17:33 +0200)] 
qemu: Adjust VM id allocation

Our atomic increment (virAtomicIntInc) uses (if available) gcc
__sync_add_and_fetch builtin. In qemu driver though, we'd profit more
from __sync_fetch_and_add builtin. To keep it simplistic, this patch
adjusts qemu driver initialization rather than adding a new atomic
increment macro.

10 years agolxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup
Peter Krempa [Tue, 28 Jul 2015 16:25:59 +0000 (18:25 +0200)] 
lxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup

virDomainDeleteConfig is meant to delete the persistent config and thus
it resets vm->autostart. Copy parts of qemuProcessRemoveDomainStatus to
a new helper to avoid using the incorrect function.

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

10 years agoremote: fix typo in remoteDomainOpenGraphicsFD
Daniel P. Berrange [Mon, 27 Jul 2015 09:29:59 +0000 (10:29 +0100)] 
remote: fix typo in remoteDomainOpenGraphicsFD

The remoteDomainOpenGraphicsFD method was using the wrong RPC
arg struct remote_domain_open_graphics_args instead of
remote_domain_open_graphics_fd_args. Fortunately both structs
had identical contents so there was no functional bug, but to
avoid confusing future maintainers, we should fix it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoadmin: Tiny cleanups
Martin Kletzander [Wed, 22 Jul 2015 09:01:58 +0000 (11:01 +0200)] 
admin: Tiny cleanups

First hunk changes the use of srcdir to top_srcdir so it complies with
other rules in the Makefile.  Second one removes the need of
remote_protocol.h in admin_protocol.h as it was suggested and worked in,
but this one line was missed apparently.  Last one just removes the
'remote' naming from admin protocol specification, just so it's cleaner.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Check for iotune_max support properly
Martin Kletzander [Mon, 27 Jul 2015 06:04:06 +0000 (08:04 +0200)] 
qemu: Check for iotune_max support properly

Commit d506a51aeb2a7a7b0c963f760e32b94376ea7173 meant to check for
QEMU_CAPS_DRIVE_IOTUNE_MAX, but checked for QEMU_CAPS_DRIVE_IOTUNE
instead.  That's clearly visible from the diff, but it got in.  Because
of that, we were supplying information unknown for QEMU if it wasn't new
enough and we couldn't even properly handle the error, leading to
"Unexpected error".  Also iops_size came at the same time with all the
other "_max" options, so check whether we're not setting that either if
QEMU_CAPS_DRIVE_IOTUNE_MAX is not supported.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotests: Finish rename of the long nodeinfo test case
Martin Kletzander [Mon, 27 Jul 2015 06:22:24 +0000 (08:22 +0200)] 
tests: Finish rename of the long nodeinfo test case

Commit 2094d01e2f54e5774c0d0d380e83154b42ea65be forgot to rename two
more files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoRenamed deconfigured-cpus to allow make dist v1.2.18-rc1
Daniel Veillard [Mon, 27 Jul 2015 02:17:05 +0000 (10:17 +0800)] 
Renamed deconfigured-cpus to allow make dist

Simplest was just to rename that extra long name and move files in git
accordingly

10 years agoconf: add virDomainControllerDefNew()
Laine Stump [Thu, 25 Jun 2015 16:55:12 +0000 (12:55 -0400)] 
conf: add virDomainControllerDefNew()

There are some non-0 default values in virDomainControllerDef (and
will soon be more) that are easier to not forget if the remembering is
done by a single initializer function (rather than inline code after
allocating the obejct with generic VIR_ALLOC().

10 years agoqemu: reorganize loop in qemuDomainAssignPCIAddresses
Laine Stump [Thu, 25 Jun 2015 16:02:32 +0000 (12:02 -0400)] 
qemu: reorganize loop in qemuDomainAssignPCIAddresses

This loop occurs just after we've assured that all devices that
require a PCI device have been assigned and all necessary PCI
controllers have been added. It is the perfect place to add other
potentially auto-generated PCI controller attributes that are
dependent on the controller's PCI address (upcoming patch).

There is a convenient loop through all controllers at the end of the
function, but the patch to add new functionality will be cleaner if we
first rearrange that loop a bit.

Note that the loop originally was accessing info.addr.pci.bus prior to
determining that the pci part of the object was valid. This isn't
dangerous in any way, but seemed a bit ugly, so I fixed it.

10 years agoconf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses
Laine Stump [Thu, 16 Jul 2015 20:28:47 +0000 (16:28 -0400)] 
conf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses

The function that auto-assigns PCI addresses was written with the
hardcoded assumptions that any PCI bus would have slots available
starting at 1 and ending at 31. This isn't true for many types of
controllers (some have a single slot/port at 0, some have slots/ports
from 0 to 31). This patch updates that function to remove the
hardcoded assumptions. It will properly find/assign addresses for
devices that can only connect to pcie-(root|downstream)-port (which
have minSlot/maxSlot of 0/0) or a pcie-switch-upstream-port (0/31).

It still will not auto-create a new bus of the proper kind for these
connections when one doesn't exist, that task is for another day.

10 years agotests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest
Chris J Arges [Tue, 30 Jun 2015 20:19:04 +0000 (15:19 -0500)] 
tests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest

Add a testcase for the previous change to ensure zero capacity volumes can be
defined without a backing store.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>