]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
7 years agoconf: Extract logic for updating 'detect_zeroes' mode
Peter Krempa [Wed, 29 Nov 2017 14:17:10 +0000 (15:17 +0100)]
conf: Extract logic for updating 'detect_zeroes' mode

For some reason we've decided to silently translate the disk
detect_zeroes mode if it would be invalid. Extract the
logic so that it does not need to be copypasta'd across the code base.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoconf: Don't require 'def' in virDomainDiskDefParse
Peter Krempa [Fri, 16 Mar 2018 14:32:09 +0000 (15:32 +0100)]
conf: Don't require 'def' in virDomainDiskDefParse

In some use cases (mostly in tests) it is not required to check the
seclabel definition validity. Add possibility to call
virDomainDiskDefParse without the domain definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoconf: Refactor/rename virDomainDiskDefSourceParse
Peter Krempa [Fri, 16 Mar 2018 11:43:23 +0000 (12:43 +0100)]
conf: Refactor/rename virDomainDiskDefSourceParse

Make the function more usable by returning the full disk definition and
fix the only caller for the new semantics. The new name for the function
is virDomainDiskDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: utils: Tolerate NULL actual data in virTestCompareToFile
Peter Krempa [Tue, 27 Mar 2018 16:14:12 +0000 (18:14 +0200)]
tests: utils: Tolerate NULL actual data in virTestCompareToFile

The function docs state that 'strcontent' may be NULL. This was added in
8b3a0b28ba2 but that commit neglected to fix rest of the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu_monitor_json: Properly check "return" type
Jiri Denemark [Wed, 28 Mar 2018 10:45:21 +0000 (12:45 +0200)]
qemu_monitor_json: Properly check "return" type

My commit 2e0d6cdec41 claimed qemuMonitorJSONCheckError guarantees
"return" object exists in the JSON reply. But it only makes sure the key
is there, while the type of the value is not checked. A lot of callers
do not care since they only want to see whether their QMP command failed
or not, but any caller which needs to read some data from the reply
wants to make sure the correct data type was returned.

This patch adds a new API called qemuMonitorJSONCheckReply which calls
qemuMonitorJSONCheckError and checks "return" contains a value of the
specified type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoutil: json: Privatize struct _virJSONValue and sub-structs
Peter Krempa [Thu, 29 Mar 2018 18:36:56 +0000 (20:36 +0200)]
util: json: Privatize struct _virJSONValue and sub-structs

Enforce usage of accessors by hiding the implementation in the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: monitor: Don't resist stealing 'actions' in qemuMonitorJSONTransaction
Peter Krempa [Fri, 30 Mar 2018 10:35:52 +0000 (12:35 +0200)]
qemu: monitor: Don't resist stealing 'actions' in qemuMonitorJSONTransaction

Rather than trying to prevent stealing of the 'actions' virJSONValue
into the monitor command replace the code so that it does the same
thing, since 'actions' was actually not really used after calling the
monitor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: qemu: Don't access virJSONValue directly in virQEMUBuildCommandLineJSONRecurse
Peter Krempa [Thu, 29 Mar 2018 18:41:07 +0000 (20:41 +0200)]
util: qemu: Don't access virJSONValue directly in virQEMUBuildCommandLineJSONRecurse

Use the accessors instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: json: Add accessor for geting a VIR_JSON_TYPE_NUMBER as string
Peter Krempa [Thu, 29 Mar 2018 18:38:35 +0000 (20:38 +0200)]
util: json: Add accessor for geting a VIR_JSON_TYPE_NUMBER as string

Sometimes it's desired to get a JSON number as string. Add a helper.
This will help in cases where we'd want to convert the internal type from
string to something else.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agojson: Replace access to virJSONValue->type by virJSONValueGetType
Peter Krempa [Thu, 29 Mar 2018 18:30:05 +0000 (20:30 +0200)]
json: Replace access to virJSONValue->type by virJSONValueGetType

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: agent: Avoid unnecessary JSON object type check
Peter Krempa [Thu, 29 Mar 2018 18:34:57 +0000 (20:34 +0200)]
qemu: agent: Avoid unnecessary JSON object type check

Use virJSONValueObjectGetArray instead of virJSONValueObjectGet so that
it's not necessary to check whether it's an array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoqemu: monitor: Use virJSONValueObjectKeysNumber in qemuMonitorJSONGetCPUModelExpansion
Peter Krempa [Fri, 30 Mar 2018 08:40:51 +0000 (10:40 +0200)]
qemu: monitor: Use virJSONValueObjectKeysNumber in qemuMonitorJSONGetCPUModelExpansion

Replace direct access to virJSONValue members by accessor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agotests: json: Validate that attribute values are properly stolen
Peter Krempa [Fri, 30 Mar 2018 10:18:50 +0000 (12:18 +0200)]
tests: json: Validate that attribute values are properly stolen

Make sure that the 'a' and 'A' modifiers for virJSONValueObjectAddVArgs
behave correctly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoutil: json: Fix freeing of objects appended to virJSONValue
Peter Krempa [Fri, 30 Mar 2018 09:12:57 +0000 (11:12 +0200)]
util: json: Fix freeing of objects appended to virJSONValue

It was not possible to determine whether virJSONValueObjectAddVArgs and
the functions using it would consume a virJSONValue or not when used
with the 'a' or 'A' modifier depending on when the loop failed.

Fix this by passing in a pointer to the pointer so that it can be
cleared once it's successfully consumed and the callers don't have to
second-guess leaving a chance of leaking or double freeing the value
depending on the ordering.

Fix all callers to pass a double pointer too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agolxc_container: Set source file description
Radostin Stoyanov [Mon, 2 Apr 2018 07:55:00 +0000 (08:55 +0100)]
lxc_container: Set source file description

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
7 years agonews: Update release news with mediated devices hot {plug,unplug}
Erik Skultety [Mon, 26 Mar 2018 12:36:27 +0000 (14:36 +0200)]
news: Update release news with mediated devices hot {plug,unplug}

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoqemu: hotplug: Introduce hot unplug for mediated devices
Erik Skultety [Mon, 26 Mar 2018 08:06:07 +0000 (10:06 +0200)]
qemu: hotplug: Introduce hot unplug for mediated devices

Mediated devices support hot-{plug,unplug} since their introduction in
kernel 4.10, however libvirt has still been missing support for this.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoqemu: hotplug: Introduce hot plug support for mediated devices
Erik Skultety [Mon, 26 Mar 2018 07:38:47 +0000 (09:38 +0200)]
qemu: hotplug: Introduce hot plug support for mediated devices

Mediated devices support hot-{plug,unplug} since their introduction in
kernel 4.10, however libvirt has still been missing support for this.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agolxc: Use virDomainObjEndAPI after FindByName
John Ferlan [Sat, 10 Mar 2018 13:47:44 +0000 (08:47 -0500)]
lxc: Use virDomainObjEndAPI after FindByName

For consistency, rather than open coding the Unref and Unlock,
just use the virDomainObjEndAPI API.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agodocs: formatdomain: Clarify CPU feature policy option "require"
Kashyap Chamarthy [Mon, 26 Mar 2018 10:53:12 +0000 (12:53 +0200)]
docs: formatdomain: Clarify CPU feature policy option "require"

Using the 'require' value for the 'policy' attribute indicates
that the guest will have the feature so the host CPU does not
need to support it if the hypervisor can emulate it.

E.g. 'x2apic' is emulated by QEMU even if the host does not support it:

    <feature policy='require' name='x2apic'/>

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
7 years agoqemu: s/acceptible/acceptable/
Ján Tomko [Sat, 31 Mar 2018 18:02:09 +0000 (20:02 +0200)]
qemu: s/acceptible/acceptable/

Prefer the contemporary spelling.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemuDomainRemoveDevice: add qemuDomainRemoveWatchdog
Ján Tomko [Sat, 31 Mar 2018 08:12:17 +0000 (10:12 +0200)]
qemuDomainRemoveDevice: add qemuDomainRemoveWatchdog

qemuDomainDetachWatchdog uses the infrastructure for waiting
for the DEVICE_DELETED event, but the asynchronous delete
was not implemented.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agoReplace QEmu with QEMU
Ján Tomko [Sat, 31 Mar 2018 14:51:14 +0000 (16:51 +0200)]
Replace QEmu with QEMU

QEMU is the preferred spelling used on QEMU website.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agovmx: convert any amount of NICs
Pino Toscano [Wed, 28 Mar 2018 11:40:21 +0000 (13:40 +0200)]
vmx: convert any amount of NICs

Scan the parsed VMX file, and gather the biggest index of the network
interfaces there: this way, it is possible to parse all the available
network interfaces, instead of just 4 maximum.

Add the VMX file attached to RHBZ#1560917 as testcase esx-in-the-wild-8.

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

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
7 years agointernal: add STRCASEPREFIX
Pino Toscano [Wed, 28 Mar 2018 11:40:20 +0000 (13:40 +0200)]
internal: add STRCASEPREFIX

Simple macro to check the prefix of a string in a case-insensitive way.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
7 years agovmx: allocate space for network interfaces if needed
Pino Toscano [Wed, 28 Mar 2018 11:40:19 +0000 (13:40 +0200)]
vmx: allocate space for network interfaces if needed

Dynamically grow the array of network interfaces for each interface
read, instead of using a single array of size 4.  This way, in the
future it will be easier to not limit the number of network interfaces
(which this patch still does not change).

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
7 years agovmx: check for present/enabled devices earlier
Pino Toscano [Wed, 28 Mar 2018 11:40:18 +0000 (13:40 +0200)]
vmx: check for present/enabled devices earlier

When parsing filesystems, network interfaces, serial ports, and
parallel ports, check earlier whether they are present/enabled, delaying
the allocation of the objects.

This is mostly a small optimization, with no behaviour change.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
7 years agoqemu: Use dynamic buffer for storing PTY aliases
Michal Privoznik [Thu, 29 Mar 2018 06:50:01 +0000 (08:50 +0200)]
qemu: Use dynamic buffer for storing PTY aliases

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

For historical reasons we've used 32 bytes long static buffer for
storing PTY aliases. This breaks users scenario where they try to
start a machine with user alias consisting of "ua-$uuid".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoPost-release version bump to 4.3.0
Michal Privoznik [Sun, 1 Apr 2018 10:32:36 +0000 (12:32 +0200)]
Post-release version bump to 4.3.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRelease of libvirt-4.2.0
Daniel Veillard [Sun, 1 Apr 2018 08:07:38 +0000 (10:07 +0200)]
Release of libvirt-4.2.0

* docs/news.xml: updated
* po/*.po*: regenerated

Signed-off-by: Daniel Veillard <veillard@redhat.com>
7 years agovirsh: add missing help info of --source to domifaddr
Chen Hanxiao [Fri, 16 Mar 2018 02:03:15 +0000 (10:03 +0800)]
virsh: add missing help info of --source to domifaddr

commit b4b5c82ce forgot to add this.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>