Commit Graph

29411 Commits

Author SHA1 Message Date
John Ferlan
a5a777a8ba 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>
2018-04-10 08:11:09 -04:00
John Ferlan
2ada9ef146 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>
2018-04-10 08:11:09 -04:00
John Ferlan
9e792d1aaa 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>
2018-04-10 08:11:09 -04:00
John Ferlan
d6d8d7bb9a 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>
2018-04-10 08:11:09 -04:00
Michal Privoznik
5f723b74ed 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>
2018-04-10 12:43:15 +02:00
Ján Tomko
ea8ff2eb64 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>
2018-04-10 12:22:53 +02:00
Ján Tomko
1ff74d67b1 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>
2018-04-10 12:22:31 +02:00
John Ferlan
3f204e4de4 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>
2018-04-09 18:26:03 -04:00
John Ferlan
67757b066c 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>
2018-04-09 18:25:51 -04:00
Jim Fehlig
990dd4b356 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>
2018-04-09 11:39:45 -06:00
Jim Fehlig
bdb6ba0fad spec: remove legacy xen driver
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:39:28 -06:00
Jim Fehlig
e2e76de055 docs: remove mention of legacy Xen driver
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:38:47 -06:00
Jim Fehlig
1dac5fbbbb 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>
2018-04-09 11:38:05 -06:00
Jim Fehlig
4392d2d49b Remove xencaps tests and data files
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 11:37:15 -06:00
Jim Fehlig
8ee83ea875 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>
2018-04-09 11:36:17 -06:00
Jim Fehlig
212da33f81 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>
2018-04-09 11:34:35 -06:00
Jim Fehlig
2ea9d403ff 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>
2018-04-09 11:33:30 -06:00
Daniel P. Berrangé
6f2c56d918 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>
2018-04-09 16:47:48 +01:00
Daniel P. Berrangé
78038351c7 remote: use a separate connection for storage APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:31 +01:00
Daniel P. Berrangé
3a33a83602 remote: use a separate connection for secret APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:31 +01:00
Daniel P. Berrangé
ad2b3fdd1c remote: use a separate connection for nwfilter APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:31 +01:00
Daniel P. Berrangé
3ebf8f5b80 remote: use a separate connection for nodedev APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:31 +01:00
Daniel P. Berrangé
ca88bbc618 remote: use a separate connection for network APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:30 +01:00
Daniel P. Berrangé
cb712443b7 remote: use a separate connection for interface APIs
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-09 15:24:30 +01:00
Daniel P. Berrangé
6f9750012c 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>
2018-04-09 15:24:18 +01:00
Daniel P. Berrangé
3c9ba9c1cd 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>
2018-04-09 15:23:34 +01:00
Daniel P. Berrangé
c09c3408d3 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>
2018-04-09 15:15:03 +01:00
Andrea Bolognani
96b1ea4032 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>
2018-04-09 09:12:21 +02:00
Erik Skultety
209d4d6f42 news: Update the news file with the log filter wildcard improvement
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-04-09 09:01:36 +02:00
Erik Skultety
8daa593b07 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>
2018-04-09 08:42:28 +02:00
Erik Skultety
8b112f2424 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>
2018-04-09 08:42:28 +02:00
Erik Skultety
aa6ec98ff2 virlog: Fix a typo in virLogParseFilter's error msg
This was some copy-paste leftover.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-04-09 08:42:28 +02:00
John Ferlan
4300a56378 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>
2018-04-06 14:23:06 -04:00
John Ferlan
d4aaa1651b 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>
2018-04-06 14:14:37 -04:00
John Ferlan
c534d10ffe 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>
2018-04-06 14:14:37 -04:00
John Ferlan
e0f7707cd5 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>
2018-04-06 14:14:37 -04:00
John Ferlan
2689a922aa 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>
2018-04-06 14:14:31 -04:00
Michal Privoznik
7b4964479d storageDriverAutostart: Drop unused @conn
This variable is not actually used in the function. Especially
after 31869efe2a.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-04-06 14:57:34 +02:00
Michal Privoznik
36e7ce761b storageVolLookupData: Drop conn struct member
Since its introduction in 5d5c732d74 it has been never used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-04-06 14:57:34 +02:00
Andrea Bolognani
eb65cc500b news: Update for pcie-to-pci-bridge support
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-06 14:12:28 +02:00
Andrea Bolognani
8238b04405 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>
2018-04-06 14:12:25 +02:00
Andrea Bolognani
898edc9617 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>
2018-04-06 14:12:21 +02:00
Andrea Bolognani
9985bb468a 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>
2018-04-06 14:12:19 +02:00
Andrea Bolognani
542f05e775 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>
2018-04-06 14:12:17 +02:00
Andrea Bolognani
1764a51b95 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>
2018-04-06 14:12:15 +02:00
Andrea Bolognani
33b2df2795 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>
2018-04-06 14:12:14 +02:00
Andrea Bolognani
d47de9e698 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>
2018-04-06 14:12:11 +02:00
Andrea Bolognani
c301f79a59 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>
2018-04-06 14:11:32 +02:00
Jim Fehlig
60dd4cc1f8 util: fix spelling in virSocketAddrParseAny docs
s/netork/network/

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-04-05 14:57:16 -06:00
Jim Fehlig
412afdb8f4 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>
2018-04-05 14:50:15 -06:00