Commit Graph

28944 Commits

Author SHA1 Message Date
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
Jim Fehlig
0987730301 util: honor reportError parameter in virSocketAddrParseInternal
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-04-05 14:46:49 -06:00
Michal Privoznik
cd9bbb7fad news: Document device mapper fix
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-04-05 16:53:19 +02:00
Michal Privoznik
6dd84f6850 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>
2018-04-05 16:52:55 +02:00
Michal Privoznik
fd9d1e686d 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>
2018-04-05 09:58:44 +02:00
Ján Tomko
3487973ee0 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>
2018-04-04 15:08:32 +02:00
John Ferlan
608938419b 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>
2018-04-04 06:53:44 -04:00
John Ferlan
ea90e0fbb9 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>
2018-04-04 06:53:38 -04:00
John Ferlan
7f8ac4bbc4 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>
2018-04-04 06:53:22 -04:00
Peter Krempa
9c75425aa2 tests: utils: Fix out-of-bounds access to memory in virTestCompareToFile
Similarly to 3506f1ecfd, 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>
2018-04-04 12:04:21 +02:00
Daniel P. Berrangé
c018533156 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>
2018-04-03 16:05:51 +01:00
Peter Krempa
a801f0e79b 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>
2018-04-03 15:48:38 +02:00
Peter Krempa
f0a528ce06 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>
2018-04-03 15:48:38 +02:00
Peter Krempa
6227c8ae5d tests: qemu: Test QCOW2 + LUKS support
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
026114b564 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>
2018-04-03 15:48:38 +02:00
Peter Krempa
f849efac72 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>
2018-04-03 15:48:38 +02:00
Peter Krempa
b874e297b2 qemu: caps: Add capability for LUKS encrypted qcow2 image support
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-04-03 15:48:38 +02:00
Peter Krempa
2d12d9482e 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>
2018-04-03 15:48:38 +02:00