]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agodriver: introduce a driver method for probing default URIs
Daniel P. Berrangé [Tue, 27 Mar 2018 16:24:44 +0000 (17:24 +0100)]
driver: introduce a driver method for probing default URIs

Currently the virDrvConnectOpen method is supposed to handle both
opening an explicit URI and auto-probing a driver if no URI is
given. Introduce a dedicated virDrvConnectURIProbe method to enable the
probing functionality to be split from the driver opening functionality.

It is still possible for NULL to be passed to the virDrvConnectOpen
method after this change, because the remote driver needs special
handling to enable probing of the URI against a remote libvirtd daemon.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolxc: allow use of lxc:///system URI as preferred format
Daniel P. Berrangé [Tue, 27 Mar 2018 13:32:07 +0000 (14:32 +0100)]
lxc: allow use of lxc:///system URI as preferred format

Historically we have used a bare lxc:/// URI for connecting to LXC. This
is different from our practice with QEMU, UML, Parallels, Libxl, BHyve
and VirtualBox drivers, which all use a path of '/system' or '/session'
or both.

By making LXC allow '/system', we have fully standardized on the use of
either '/system' or '/session' for all the stateful drivers that run
inside libvirtd.

Support for lxc:/// is of course maintained for back-compat.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoxen: encourage use of xen:///system URI as preferred format
Daniel P. Berrangé [Tue, 27 Mar 2018 13:32:07 +0000 (14:32 +0100)]
xen: encourage use of xen:///system URI as preferred format

Historically we have used a bare xen:/// URI for connecting to the
legacy Xen driver. The new libxl Xen driver follows the new practice
of allowing '/system' as a path, as well as bare '/' for compat with
the old Xen driver.

This documents xen:///system as the preferred format for Xen, leaving
xen:/// as an undocumented feature just for back-compat.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_DRIVE_SERIAL
Ján Tomko [Thu, 29 Mar 2018 10:51:55 +0000 (12:51 +0200)]
qemu: deprecate QEMU_CAPS_DRIVE_SERIAL

Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_MEM_PATH
Ján Tomko [Thu, 29 Mar 2018 10:46:23 +0000 (12:46 +0200)]
qemu: deprecate QEMU_CAPS_MEM_PATH

Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_NO_USER_CONFIG
Ján Tomko [Thu, 29 Mar 2018 10:51:55 +0000 (12:51 +0200)]
qemu: deprecate QEMU_CAPS_NO_USER_CONFIG

Implied by QEMU >= 1.2.0.

Delete this one first, because QEMU_CAPS_NODEFCONFIG is only used
when QEMU_CAPS_NO_USER_CONFIG is unsupported.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_MONITOR_JSON
Ján Tomko [Wed, 28 Mar 2018 22:04:58 +0000 (00:04 +0200)]
qemu: deprecate QEMU_CAPS_MONITOR_JSON

We require QEMU >= 1.5.0, assume every QEMU supports it.
Sadly that does not let us trivially drop qemuMonitor's
priv->monJSON bool, because of qemuDomainQemuAttach.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: remove qemuDomainSupportsNetdev
Ján Tomko [Wed, 28 Mar 2018 23:36:20 +0000 (01:36 +0200)]
qemu: remove qemuDomainSupportsNetdev

Now that we assume QEMU_CAPS_NETDEV, the only thing left to check
is whether we need to use the legacy -net syntax because of
a non-conforming armchitecture.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: remove unused qemuDomainNetVLAN
Ján Tomko [Wed, 28 Mar 2018 23:26:54 +0000 (01:26 +0200)]
qemu: remove unused qemuDomainNetVLAN

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: clean up qemuDomainAttachNetDevice
Ján Tomko [Wed, 28 Mar 2018 23:25:00 +0000 (01:25 +0200)]
qemu: clean up qemuDomainAttachNetDevice

Now that we assume -netdev support, we no longer set the VLAN
or need the hostPlugged bool.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_NETDEV
Ján Tomko [Wed, 28 Mar 2018 21:36:13 +0000 (23:36 +0200)]
qemu: deprecate QEMU_CAPS_NETDEV

This makes qemuDomainSupportsNetdev identical to
qemuDomainSupportsNicdev and leaves some code in
qemuDomainAttachNetDevice to be cleaned up later.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: deprecate QEMU_CAPS_PCI_MULTIFUNCTION
Ján Tomko [Wed, 28 Mar 2018 21:20:45 +0000 (23:20 +0200)]
qemu: deprecate QEMU_CAPS_PCI_MULTIFUNCTION

Supported since QEMU 0.13, but we require QEMU 1.5.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agotests: remove FLAG_JSON from xml2argvtest
Ján Tomko [Thu, 12 Apr 2018 15:11:14 +0000 (17:11 +0200)]
tests: remove FLAG_JSON from xml2argvtest

Unused as of commit <1e9a083>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoconf: Actually make virDomainChrSourceDef an object
Michal Privoznik [Thu, 12 Apr 2018 07:10:33 +0000 (09:10 +0200)]
conf: Actually make virDomainChrSourceDef an object

In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
virObject. Well, this requires 'virObject' member to be stored on
the first position of the struct. This adjustment is missing in
the original commit leading to all sorts of funny memleaks and
data corruptions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoapparmor: add rules to use qemu_bridge_helper
Christian Ehrhardt [Mon, 9 Apr 2018 06:24:19 +0000 (08:24 +0200)]
apparmor: add rules to use qemu_bridge_helper

Due to mediation of socket and signal activity currently qemu:///session
connections calling qemu_bridge_helper fail.

We need the profile for libvirtd itself and the subprofile for
qemu-bridge-helper to be able to talk/notify to each other via unix socket and
signals.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1754871
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovbox: Make vboxCommonDriver static
Michal Privoznik [Thu, 12 Apr 2018 06:25:44 +0000 (08:25 +0200)]
vbox: Make vboxCommonDriver static

This is a global variable, but it isn't accessible from outside
of the file its declared in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agolibxl: add support for memballoon device
Jim Fehlig [Tue, 10 Apr 2018 00:15:17 +0000 (18:15 -0600)]
libxl: add support for memballoon device

All Xen PV and HVM with PV driver support a memory balloon device,
which cannot be disabled through the toolstack. Model the device
in the libxl driver, similar to the recently removed xend-based
driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agonews: announce dropping of legacy Xen driver
Jim Fehlig [Fri, 6 Apr 2018 22:37:55 +0000 (16:37 -0600)]
news: announce dropping of legacy Xen driver

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoopenvz: Use virDomainObjListFindBy{UUID|ID}Ref
John Ferlan [Fri, 9 Mar 2018 16:48:04 +0000 (11:48 -0500)]
openvz: Use virDomainObjListFindBy{UUID|ID}Ref

For openvzDomObjFromDomainLocked and openvzDomainLookupByID
let's return a locked and referenced @vm object so that callers
can then use the common and more consistent virDomainObjEndAPI
in order to handle cleanup rather than needing to know that the
returned object is locked and calling virObjectUnlock.

The LookupByName already returns the ref counted and locked object,
so this will make things more consistent.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agoopenvz: Add more descriptive error message on Find failure
John Ferlan [Fri, 9 Mar 2018 16:48:03 +0000 (11:48 -0500)]
openvz: Add more descriptive error message on Find failure

If openvzDomainLookupByID or openvzDomainLookupByName fails
to find a vm, let's be a bit more descriptive by providing
the failing id or name in the error message.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agoopenvz: Create accessors to virDomainObjListFindByUUID
John Ferlan [Fri, 9 Mar 2018 16:48:02 +0000 (11:48 -0500)]
openvz: Create accessors to virDomainObjListFindByUUID

Rather than repeat code throughout, create and use a couple of
accessors in order to lookup by UUID.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
7 years agolxc: Fix object locking after virDomainObjListRemove
John Ferlan [Mon, 2 Apr 2018 13:43:50 +0000 (09:43 -0400)]
lxc: Fix object locking after virDomainObjListRemove

The virDomainObjListRemove will return an unlocked
@vm after calling with a reffed object, thus prior
to calling virDomainObjEndAPI we should relock.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agolxc: Fix possible leaked @vm in lxcDomainCreateXMLWithFiles
John Ferlan [Mon, 2 Apr 2018 14:03:02 +0000 (10:03 -0400)]
lxc: Fix possible leaked @vm in lxcDomainCreateXMLWithFiles

In error paths, if we call virDomainObjListRemove we will leak
the @vm because we have called with a reffed and locked @vm.
So rather than set it to NULL, relock the @vm and allow the
virDomainObjEndAPI to perform the magic of Unlock/Unref.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agobhyve: Use virDomainObjListFindBy{UUID|ID}Ref
John Ferlan [Mon, 23 Oct 2017 15:00:42 +0000 (11:00 -0400)]
bhyve: Use virDomainObjListFindBy{UUID|ID}Ref

For bhyveDomObjFromDomain, bhyveDomainLookupByUUID, and
bhyveDomainLookupByID let's return a locked and referenced
@vm object so that callers can then use the common and more
consistent virDomainObjEndAPI in order to handle cleanup rather
than needing to know that the returned object is locked and
calling virObjectUnlock.

The LookupByName already returns the ref counted and locked object,
so this will make things more consistent.

For bhyveDomainUndefine and bhyveDomainDestroy since the
virDomainObjListRemove will return an unlocked object, we need to
relock before making the EndAPI call.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Format gic-version=2 on the command line
Andrea Bolognani [Thu, 29 Mar 2018 11:38:30 +0000 (13:38 +0200)]
qemu: Format gic-version=2 on the command line

Up until now we have only formatted non-default GIC versions on
the command line, in order to maintain compatibility with older
QEMU versions that didn't implement the gic-version option to
begin with; however, doing so is entirely unnecessary for newer
QEMU versions, where the option is available. Moreover, having
the GIC version formatted on the command line at all times
ensures that QEMU changing its own defaults doesn't affect the
ABI of libvirt guests.

A few test cases are removed to avoid extra churn. It doesn't
matter for coverage, as those scenarios are already covered by
other parts of the test suite.

This patch is better viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: don't check for parallel iteration in hash-related functions
Vincent Bernat [Tue, 10 Apr 2018 06:27:15 +0000 (08:27 +0200)]
util: don't check for parallel iteration in hash-related functions

This is the responsability of the caller to apply the correct lock
before using these functions. Moreover, the use of a simple boolean
was still racy: two threads may check the boolean and "lock" it
simultaneously.

Users of functions from src/util/virhash.c have to be checked for
correctness. Lookups and iteration should hold a RO
lock. Modifications should hold a RW lock.

Most important uses seem to be covered. Callers have now a greater
responsability, notably the ability to execute some operations while
iterating were reliably forbidden before are now accepted.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
7 years agotravis: skip builds on -maint branches
Daniel P. Berrangé [Wed, 21 Mar 2018 14:04:54 +0000 (14:04 +0000)]
travis: skip builds on -maint branches

For patches pushed upstream we want builds run on master branch, but
don't want them run on the -maint branches, as we are not keeping the
.travis.yml file on stable branches updated wrt latest needs of travis
CI platforms.

We can't just whitelist 'master' though, because that will prevent
developers triggering their own private travis builds. So we just
blacklist *-maint, since developers will typically use named feature
branches for any work.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: extend preallocation flags support for qemu-img
Wim ten Have [Mon, 9 Apr 2018 18:14:35 +0000 (20:14 +0200)]
storage: extend preallocation flags support for qemu-img

This patch adds support to qcow2 formatted filesystem object storage by
instructing qemu-img to build them with preallocation=falloc whenever the
XML described storage <allocation> matches its <capacity>.  For all other
cases the filesystem stored objects are built with preallocation=metadata.

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRequire QEMU 1.5.0
Ján Tomko [Tue, 10 Apr 2018 12:52:47 +0000 (14:52 +0200)]
Require QEMU 1.5.0

According to the policy described on https://libvirt.org/platforms.html
the QEMU versions in the oldest relevant releses are:

  SLES 12: 2.0.0
  RHEL 7: 1.5.3
  Ubuntu 14.04: 2.0.0

Set the minimum to 1.5.0 and drop support for RHEL 6.

This will let us assume lots of capabilities.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoForce QMP capability probing
Ján Tomko [Wed, 28 Mar 2018 20:46:41 +0000 (22:46 +0200)]
Force QMP capability probing

Remove the qmpOnly argument of virQEMUCapsNewForBinaryInternal
and instead always assume it's true.

This effectively sets the minimum QEMU version to 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Obtain reference on monConfig
John Ferlan [Fri, 6 Apr 2018 16:14:44 +0000 (12:14 -0400)]
qemu: Obtain reference on monConfig

Because we allow a QEMU_JOB_DESTROY to occur while we're starting
up and we drop the @vm lock prior to qemuMonitorOpen, it's possible
that a domain destroy operation "wins" the race, calls qemuProcessStop
which will free and reinitialize priv->monConfig. Depending on the
exact timing either qemuMonitorOpen will be passed a NULL @config
variable or it will be using free'd (and possibly reclaimed) memory
as the @config parameter - neither of which is good.

Resolve this by localizing the @monConfig, taking an extra reference,
and then once we get the @vm lock again removing our reference since
we are done with it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoconf: Convert virDomainChrSourceDefNew to return object
John Ferlan [Fri, 6 Apr 2018 16:05:38 +0000 (12:05 -0400)]
conf: Convert virDomainChrSourceDefNew to return object

Let's use object referencing to handle the ChrSourceDef. A subsequent
patch then can allow the monConfig to take an extra reference before
dropping the domain lock to then ensure nothing free's the memory that
needs to be used.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemu: Use virDomainChrSourceDefNew for monConfig
John Ferlan [Fri, 6 Apr 2018 15:49:01 +0000 (11:49 -0400)]
qemu: Use virDomainChrSourceDefNew for monConfig

Rather than VIR_ALLOC, use the New function for allocation. We
already use the Free function anyway.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoconf: Use virDomainChrSourceDefNew for vhostuser
John Ferlan [Fri, 6 Apr 2018 15:47:33 +0000 (11:47 -0400)]
conf: Use virDomainChrSourceDefNew for vhostuser

Rather than using VIR_ALLOC, use the New API since we already
use the virDomainChrSourceDefFree function when done.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemuDomainNamespaceSetupDisk: Fix const correctness
Michal Privoznik [Mon, 9 Apr 2018 12:39:23 +0000 (14:39 +0200)]
qemuDomainNamespaceSetupDisk: Fix const correctness

The array of strings we are building is indeed array of const
strings. We are not STRDUP()-ing them nor FREE()-ing them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoDelete bogus cpu-host-passthrough test
Ján Tomko [Fri, 30 Mar 2018 06:05:58 +0000 (08:05 +0200)]
Delete bogus cpu-host-passthrough test

We test the same XML for a type='kvm' domain twice, once with
QEMU_CAPS_KVM (expecting success), once without (expecting failure).

The failure case relies on QEMU_CAPS_MACHINE_OPT not being set,
failing in qemuBuildObsoleteAccelArg.

Checking a domain-type error message in a cpu test is strange.
Delete the negative test to allow assuming QEMU_CAPS_MACHINE_OPT by
default.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemuxml2argvtest: Fix q35-virt-manager capabilities
Ján Tomko [Fri, 30 Mar 2018 05:58:15 +0000 (07:58 +0200)]
qemuxml2argvtest: Fix q35-virt-manager capabilities

Use QEMU_CAPS_MACHINE_OPT and QEMU_CAPS_MACHINE_VMPORT_OPT
since it specifies <vmport state=off/>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agoutil: Alter virCloseCallback typedef to return void
John Ferlan [Tue, 27 Mar 2018 15:39:53 +0000 (11:39 -0400)]
util: Alter virCloseCallback typedef to return void

Since virCloseCallbacksRun was ignoring the value anyway, let's
just change it to be a void function.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemu: Fix qemuProcessAutoDestroy
John Ferlan [Tue, 27 Mar 2018 15:53:41 +0000 (11:53 -0400)]
qemu: Fix qemuProcessAutoDestroy

Upon entry from virCloseCallbacksRun, the @dom will have a
Ref and Lock from virDomainObjListFindByUUIDRef, so there's
no need to take an extra reference nor should the code call
virDomainObjEndAPI when done since that both Unref's and
Unlock's the @dom which means the callers call to EndAPI
would be unlocking an unlocked object. At least the Ref
saved the code from referencing something already freed.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agodocs: update Xen driver information
Jim Fehlig [Fri, 6 Apr 2018 19:54:09 +0000 (13:54 -0600)]
docs: update Xen driver information

Now that the old Xen driver is removed, update the drvxen
page with current information on the libxl drvier and remove
all the old cruft.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agospec: remove legacy xen driver
Jim Fehlig [Wed, 28 Mar 2018 23:57:10 +0000 (17:57 -0600)]
spec: remove legacy xen driver

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodocs: remove mention of legacy Xen driver
Jim Fehlig [Wed, 28 Mar 2018 23:51:41 +0000 (17:51 -0600)]
docs: remove mention of legacy Xen driver

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoRemove the xend driver
Jim Fehlig [Wed, 28 Mar 2018 22:50:04 +0000 (16:50 -0600)]
Remove the xend driver

xend was deprecated in Xen 4.2 and removed from the Xen sources
before the Xen 4.5 release. The last Xen release to contain xend
was Xen 4.4, which was retired upstream in March 2017.

Remove xend support from libvirt since it is unrealistic to use
modern libvirt with ancient Xen.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoRemove xencaps tests and data files
Jim Fehlig [Wed, 28 Mar 2018 22:20:24 +0000 (16:20 -0600)]
Remove xencaps tests and data files

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: move xmconfig tests to WITH_LIBXL
Jim Fehlig [Fri, 30 Dec 2016 21:43:43 +0000 (14:43 -0700)]
tests: move xmconfig tests to WITH_LIBXL

In preparation of removing the legacy Xen driver, move the
xmconfig tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert xm config to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions. For
consistency with other Xen config tests, change the <os> arch to
x86_64.

There is some test file fallout due to differences in handling of
default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: move sexpr2xml tests to WITH_LIBXL
Jim Fehlig [Tue, 27 Dec 2016 23:19:43 +0000 (16:19 -0700)]
tests: move sexpr2xml tests to WITH_LIBXL

In preparation of removing the legacy Xen driver, move the
sexpr2xml tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotests: move xml2sexpr tests to WITH_LIBXL
Jim Fehlig [Tue, 27 Dec 2016 22:27:08 +0000 (15:27 -0700)]
tests: move xml2sexpr tests to WITH_LIBXL

In preparation of removing the legacy Xen driver, move the
xml2sexpr tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr <-> XML.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: fix path for locating libvirtd in source tree during autostart
Daniel P. Berrangé [Thu, 22 Mar 2018 14:53:55 +0000 (14:53 +0000)]
remote: fix path for locating libvirtd in source tree during autostart

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for storage APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for storage APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for secret APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for secret APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for nwfilter APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for nwfilter APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for nodedev APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for nodedev APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for network APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for network APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: use a separate connection for interface APIs
Daniel P. Berrangé [Thu, 22 Mar 2018 11:16:25 +0000 (11:16 +0000)]
remote: use a separate connection for interface APIs

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoremote: push check for conn down into remoteClientFreePrivateCallbacks
Daniel P. Berrangé [Thu, 5 Apr 2018 10:40:55 +0000 (11:40 +0100)]
remote: push check for conn down into remoteClientFreePrivateCallbacks

There will shortly be many connection objects, so we should not assume a
single check against priv->conn is sufficient.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpc: refactor way connection object is generated for remote dispatch
Daniel P. Berrangé [Thu, 22 Mar 2018 11:12:08 +0000 (11:12 +0000)]
rpc: refactor way connection object is generated for remote dispatch

Calling a push_privconn method to directly push the connection object
name into the arg list is inconvenient. Refactor so that we acquire
the connection variable name upfront, and push it to the arg list
separately. This allows various hardcoded usage of "priv->conn" to
be parameterized.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agodocs: add page describing goals for host platform version support
Daniel P. Berrangé [Tue, 3 Apr 2018 14:53:17 +0000 (15:53 +0100)]
docs: add page describing goals for host platform version support

Described how we decide which host platforms to support for libvirt,
which in turn makes it easier to decide when a platform / software
version can be dropped.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoconf: Remove dubious code from virDomainPCIAddressSetGrow()
Andrea Bolognani [Tue, 27 Mar 2018 12:23:29 +0000 (14:23 +0200)]
conf: Remove dubious code from virDomainPCIAddressSetGrow()

I haven't been able to come up with a single scenario in which
the code in question would be executed; even if there was one,
it would be due to the user specifying a *partial* PCI topology
in the guest XML, which is of course entirely unsupportable and
thus providing even the slightest hint that doing so is in any
way a good idea is actively harmful.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agonews: Update the news file with the log filter wildcard improvement
Erik Skultety [Tue, 3 Apr 2018 08:10:17 +0000 (10:10 +0200)]
news: Update the news file with the log filter wildcard improvement

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoutil: virlog: Introduce wildcard to log filters
Erik Skultety [Tue, 3 Apr 2018 07:52:32 +0000 (09:52 +0200)]
util: virlog: Introduce wildcard to log filters

Since the introduction of log tuning capabilities to virt-admin by
@06b91785, this has been a much needed missing improvement on the way to
deprecate the global 'log_level'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agolibvirtd.conf: Document that we do a 'first' match on log filters
Erik Skultety [Tue, 3 Apr 2018 07:56:09 +0000 (09:56 +0200)]
libvirtd.conf: Document that we do a 'first' match on log filters

When applying the log filters, one has to define the more specific
filters before the generic ones, because the first filter that matches
will be applied. However, we've been missing this information in the
config, so it always has been a trial-error scenario figuring out that
e.g. '4:util 1:util.pci' doesn't actually enable verbose logging on the
src/util/virpci.c module because 4:util will be matched first.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agovirlog: Fix a typo in virLogParseFilter's error msg
Erik Skultety [Tue, 3 Apr 2018 07:50:59 +0000 (09:50 +0200)]
virlog: Fix a typo in virLogParseFilter's error msg

This was some copy-paste leftover.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agodocs: Update the format of the generate metadata example
John Ferlan [Wed, 4 Apr 2018 20:17:16 +0000 (16:17 -0400)]
docs: Update the format of the generate metadata example

Initially, update the UUID field to have the proper format, but
then also changed the type, id, and name fields.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agoconf: Fix virDomainObjParseFile object handling
John Ferlan [Mon, 26 Mar 2018 22:21:59 +0000 (18:21 -0400)]
conf: Fix virDomainObjParseFile object handling

When virDomainObjParseFile runs, it returns a locked @obj with
one reference. Rather than just use virObjectUnref to clean that
up, use virObjectEndAPI.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Introduce virDomainObjListAddObjLocked
John Ferlan [Mon, 26 Mar 2018 22:18:56 +0000 (18:18 -0400)]
conf: Introduce virDomainObjListAddObjLocked

Create a common helper to add an object to the locked domain
objlist hash tables and use it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Fix error path logic in virDomainObjListLoadStatus
John Ferlan [Mon, 26 Mar 2018 23:14:30 +0000 (19:14 -0400)]
conf: Fix error path logic in virDomainObjListLoadStatus

If the virHashAddEntry fails, then we need to "careful" about
how we free the @obj. When virDomainObjParseFile returns there
is one reference and the object is locked, so use virDomainObjEndAPI
when done.

Add a virObjectRef in the error path for the second virHashAddEntry
call since it doesn't call virObjectRef, but virHashRemoveEntry
will call virObjectUnref because virObjectFreeHashData is called
when the element is removed from the hash table as set up in
virDomainObjListNew.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Fix error path logic in virDomainObjListAddLocked
John Ferlan [Mon, 26 Mar 2018 22:29:30 +0000 (18:29 -0400)]
conf: Fix error path logic in virDomainObjListAddLocked

If the virHashAddEntry fails, then we need to "careful" about
how we free the @vm. When virDomainObjNew returns there is one
reference and the object is locked, so use virDomainObjEndAPI
when done.

Add a virObjectRef in the error path for the second virHashAddEntry
call since it doesn't call virObjectRef, but virHashRemoveEntry
will call virObjectUnref because virObjectFreeHashData is called
when the element is removed from the hash table as set up in
virDomainObjListNew.

Eventually these paths should goto error and error should be changed
to use EndAPI as well, but that requires more adjustments to other
paths in the code to have a locked and ref counted @vm.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agostorageDriverAutostart: Drop unused @conn
Michal Privoznik [Fri, 6 Apr 2018 12:02:28 +0000 (14:02 +0200)]
storageDriverAutostart: Drop unused @conn

This variable is not actually used in the function. Especially
after 31869efe2a8.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agostorageVolLookupData: Drop conn struct member
Michal Privoznik [Fri, 6 Apr 2018 12:01:02 +0000 (14:01 +0200)]
storageVolLookupData: Drop conn struct member

Since its introduction in 5d5c732d748d64 it has been never used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agonews: Update for pcie-to-pci-bridge support
Andrea Bolognani [Wed, 28 Mar 2018 13:34:32 +0000 (15:34 +0200)]
news: Update for pcie-to-pci-bridge support

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Use pcie-to-pci-bridge for aarch64-traditional-pci
Andrea Bolognani [Wed, 28 Mar 2018 10:48:38 +0000 (12:48 +0200)]
tests: Use pcie-to-pci-bridge for aarch64-traditional-pci

Now that support for the pcie-to-pci-bridge controller has
been implemented, adding the QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
capability to the existing test is enough to cause the guest
to use pcie-to-pci-bridge instead of dmi-to-pci-bridge.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Prefer pcie-to-pci-bridge to dmi-to-pci-bridge
Andrea Bolognani [Wed, 28 Mar 2018 10:48:21 +0000 (12:48 +0200)]
conf: Prefer pcie-to-pci-bridge to dmi-to-pci-bridge

Both pcie-to-pci-bridge and dmi-to-pci-bridge can be used to
create a traditional PCI topology in a pure PCIe guest such as
those using the x86_64/q35 or aarch64/virt machine type;
however, the former should be preferred, as it doesn't need to
obey limitation of real hardware and is completely
architecture-agnostic.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported
Andrea Bolognani [Fri, 23 Mar 2018 17:52:22 +0000 (18:52 +0100)]
conf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported

Just like the existing areMultipleRootsSupported, this will
allow us to change the results of the driver-agnostic PCI
address allocation logic based on whether the QEMU binary
supports certain features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Implement pcie-to-pci-bridge controller
Andrea Bolognani [Thu, 11 Jan 2018 16:28:43 +0000 (17:28 +0100)]
qemu: Implement pcie-to-pci-bridge controller

The new controller will not yet be used automatically by
libvirt, but at this point it's already possible to configure
a guest to use it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Add QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
Andrea Bolognani [Tue, 9 Jan 2018 17:05:30 +0000 (18:05 +0100)]
qemu: Add QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE

This capability will be set when the pcie-pci-bridge device
is available in the QEMU binary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: Rename virDomainPCIAddressSet.areMultipleRootsSupported
Andrea Bolognani [Wed, 28 Mar 2018 10:28:38 +0000 (12:28 +0200)]
conf: Rename virDomainPCIAddressSet.areMultipleRootsSupported

We're going to add a similarly-named attribute later, and we'd
like to be consistent.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agotests: Add aarch64-traditional-pci test
Andrea Bolognani [Tue, 9 Jan 2018 17:42:51 +0000 (18:42 +0100)]
tests: Add aarch64-traditional-pci test

This test shows what happens when you add a traditional PCI
device such as pci-serial to a pure PCIe machine type such
as aarch64/virt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agodocs: Tweak PCI controller model documentation
Andrea Bolognani [Wed, 28 Mar 2018 13:12:53 +0000 (15:12 +0200)]
docs: Tweak PCI controller model documentation

Instead of first listing the models on their own, and then
listing them again grouped by the libvirt release they were
introduced in, have a single list.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: fix spelling in virSocketAddrParseAny docs
Jim Fehlig [Thu, 5 Apr 2018 20:57:16 +0000 (14:57 -0600)]
util: fix spelling in virSocketAddrParseAny docs

s/netork/network/

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
7 years agoutil: introduce virSocketAddrParseAny
Jim Fehlig [Mon, 26 Mar 2018 18:53:05 +0000 (12:53 -0600)]
util: introduce virSocketAddrParseAny

When preparing for migration, the libxl driver creates a new TCP listen
socket for the incoming migration by calling virNetSocketNewListenTCP,
passing the destination host name. virNetSocketNewListenTCP calls
virSocketAddrParse to check if the host name is a wildcard address, in
which case it avoids adding the AI_ADDRCONFIG flag to the hints passed to
getaddrinfo. If the host name is not an IP address, virSocketAddrParse
reports an error

error : virSocketAddrParseInternal:121 : Cannot parse socket address
'myhost.example.com': Name or service not known

But virNetSocketNewListenTCP succeeds regardless and the overall migration
operation succeeds.

Introduce virSocketAddrParseAny and use it when simply testing if a host
name/addr is parsable.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: honor reportError parameter in virSocketAddrParseInternal
Jim Fehlig [Mon, 26 Mar 2018 19:00:25 +0000 (13:00 -0600)]
util: honor reportError parameter in virSocketAddrParseInternal

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agonews: Document device mapper fix
Michal Privoznik [Mon, 26 Mar 2018 05:11:42 +0000 (07:11 +0200)]
news: Document device mapper fix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu_cgroup: Handle device mapper targets properly
Michal Privoznik [Thu, 5 Apr 2018 07:34:25 +0000 (09:34 +0200)]
qemu_cgroup: Handle device mapper targets properly

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

Problem with device mapper targets is that there can be several
other devices 'hidden' behind them. For instance, /dev/dm-1 can
consist of /dev/sda, /dev/sdb and /dev/sdc. Therefore, when
setting up devices CGroup and namespaces we have to take this
into account.

This bug was exposed after Linux kernel was fixed. Initially,
kernel used different functions for getting block device in
open() and ioctl(). While CGroup permissions were checked in the
former case, due to a bug in kernel they were not checked in the
latter case. This changed with the upstream commit of
519049afead4f7c3e6446028c41e99fde958cc04 (v4.16-rc5~11^2~4).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoutil: Introduce virDevMapperGetTargets
Michal Privoznik [Mon, 26 Mar 2018 12:48:07 +0000 (14:48 +0200)]
util: Introduce virDevMapperGetTargets

This helper fetches dependencies for given device mapper target.

At the same time, we need to provide a dummy log function because
by default libdevmapper prints out error messages to stderr which
we need to suppress.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirjsontest: Use a more stable floating point number for testing
Ján Tomko [Thu, 11 Jan 2018 13:41:58 +0000 (14:41 +0100)]
virjsontest: Use a more stable floating point number for testing

We store all JSON numbers as strings. To allow using json libraries
that store them in numeric types, use a more predictable and normalized
value.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agotest: Use virDomainObjListFindByIDRef
John Ferlan [Tue, 27 Mar 2018 17:16:38 +0000 (13:16 -0400)]
test: Use virDomainObjListFindByIDRef

Rather than using virDomainObjListFindByID, let's be more consistent
and return a reffed and locked object. Since we're using the Ref API,
use virDomainObjEndAPI on @dom and not just virObjectUnlock.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agotest: Use virDomainObjListFindByUUIDRef
John Ferlan [Fri, 9 Mar 2018 15:37:52 +0000 (10:37 -0500)]
test: Use virDomainObjListFindByUUIDRef

Rather than using virDomainObjListFindByUUID, let's be more consistent
and return a reffed and locked object. Since we're using the Ref API,
use virDomainObjEndAPI on @dom and not just virObjectUnlock.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agotest: Need to relock afer virDomainObjListRemove
John Ferlan [Tue, 27 Mar 2018 17:39:52 +0000 (13:39 -0400)]
test: Need to relock afer virDomainObjListRemove

For all @dom's fetched from a testDomObjFromDomain because
virDomainObjListRemove will return an unlocked domain object
we should relock it prior to the cleanup label which will use
virDomainObjEndAPI which would Unlock and Unref the passed
object (and we should avoid unlocking an unlocked object).

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agotests: utils: Fix out-of-bounds access to memory in virTestCompareToFile
Peter Krempa [Tue, 3 Apr 2018 14:16:52 +0000 (16:16 +0200)]
tests: utils: Fix out-of-bounds access to memory in virTestCompareToFile

Similarly to 3506f1ecfde, the contents of 'cmpcontent' may be an empty
string so the following code would access memory out of the array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agorpm: add deps on rpcgen/libtirpc-devel
Daniel P. Berrangé [Tue, 3 Apr 2018 12:41:46 +0000 (13:41 +0100)]
rpm: add deps on rpcgen/libtirpc-devel

Since RPC support moved out of glibc we need to have explicit deps on
the new packages providing this functionality

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agoqemu: domain: Move initialization of disk cachemode for <shareable> disks
Peter Krempa [Tue, 27 Mar 2018 09:11:26 +0000 (11:11 +0200)]
qemu: domain: Move initialization of disk cachemode for <shareable> disks

The qemu command line generator code set disk caching of shareable disks
to 'none' when formatting the command line silently. Move this code to a
common place when preparing the domain definition for startup so that it
does not have to be duplicated.

The new test case shows that the actual cache mode will now be recorded
in the live XML definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemuxml2argv: Allow testing of config processed at startup
Peter Krempa [Tue, 27 Mar 2018 09:11:01 +0000 (11:11 +0200)]
tests: qemuxml2argv: Allow testing of config processed at startup

Add a new kind of XML output test for the files in qemuxml2argvtest
where we can validate setup and defaults applied when starting up the
VM.

This is achieved by formatting of the definition processed by the
qemuxml2argvtest into a XML and it's compared against files in
qemuxml2startupxmloutdata. This test is automatically executed if the
output file is present and it's skipped otherwise.

The first example test case is created from 'disk-drive-shared' test
case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: qemu: Test QCOW2 + LUKS support
Peter Krempa [Wed, 28 Mar 2018 13:39:35 +0000 (15:39 +0200)]
tests: qemu: Test QCOW2 + LUKS support

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: command: Add support for qcow2 + luks
Peter Krempa [Wed, 28 Mar 2018 10:21:31 +0000 (12:21 +0200)]
qemu: command: Add support for qcow2 + luks

The old qcow2 encryption format was buggy, so the new approach is to use
luks inside qcow2. As it turns out, it didn't require that many changes.

It was necessary to fix the command line formatter to stop mangling the
format when secrets are present and specify the encryption format and
secret in correct format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: domain: Validate support for LUKS encryption of QCOW2 images
Peter Krempa [Thu, 29 Mar 2018 06:50:30 +0000 (08:50 +0200)]
qemu: domain: Validate support for LUKS encryption of QCOW2 images

Reject configurations when qemu would not support the image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: caps: Add capability for LUKS encrypted qcow2 image support
Peter Krempa [Wed, 28 Mar 2018 11:29:11 +0000 (13:29 +0200)]
qemu: caps: Add capability for LUKS encrypted qcow2 image support

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: domain: Forbid VIR_STORAGE_FILE_ISO as a disk format
Peter Krempa [Thu, 29 Mar 2018 06:49:08 +0000 (08:49 +0200)]
qemu: domain: Forbid VIR_STORAGE_FILE_ISO as a disk format

This format is used by the storage driver and other hypervisors but qemu
does not have notion of the 'iso' format and libvirt does not translate
it to anything useful, so it would not work anyways. Users should use
'raw' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: domain: Forbid VIR_STORAGE_FILE_DIR as a disk format
Peter Krempa [Thu, 29 Mar 2018 06:47:10 +0000 (08:47 +0200)]
qemu: domain: Forbid VIR_STORAGE_FILE_DIR as a disk format

This is a storage driver type, which is not handled in qemu driver
properly. For accessing directories, disk type 'dir' is used instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: domain: Forbid storage type 'cow' in qemu
Peter Krempa [Fri, 23 Mar 2018 13:08:36 +0000 (14:08 +0100)]
qemu: domain: Forbid storage type 'cow' in qemu

QEMU does not support it so save us the hassle and forbid it right away.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: domain: Add helper to initialize detected parts of the backing chain
Peter Krempa [Tue, 5 Dec 2017 15:40:27 +0000 (16:40 +0100)]
qemu: domain: Add helper to initialize detected parts of the backing chain

It will be necessary to initialize various aspects for the detected
members of the backing chain. Add a function that will handle it and
call it from qemuDomainPrepareDiskSource and qemuDomainDetermineDiskChain

Signed-off-by: Peter Krempa <pkrempa@redhat.com>