]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoqemu: hotplug: Remove misleading comment in qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 18:08:57 +0000 (20:08 +0200)]
qemu: hotplug: Remove misleading comment in qemuDomainGetTLSObjects

'secinfo' is present also for migrations. Delete the misleading comment.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Pass around existing secret object alias from qemuDomainAddChardevTLSO...
Peter Krempa [Tue, 29 May 2018 18:03:07 +0000 (20:03 +0200)]
qemu: hotplug: Pass around existing secret object alias from qemuDomainAddChardevTLSObjects

Setting up the 'secinfo' for the TLS private key password also generates
the given alias, so we don't need to generate another one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: migration: Don't pass around secAlias
Peter Krempa [Tue, 29 May 2018 17:56:05 +0000 (19:56 +0200)]
qemu: migration: Don't pass around secAlias

The alias of the secret for decrypting the TLS passphrase is useless
besides for TLS setup. Stop passing it around.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Always setup TLS environment if src->haveTLS is on
Peter Krempa [Tue, 29 May 2018 12:57:37 +0000 (14:57 +0200)]
qemu: command: Always setup TLS environment if src->haveTLS is on

We make sure that the disk supports TLS when preparing the environment
so there's no need to duplicate checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Pass in alias for TLS object to qemuBuildTLSx509CommandLine
Peter Krempa [Tue, 29 May 2018 16:04:42 +0000 (18:04 +0200)]
qemu: command: Pass in alias for TLS object to qemuBuildTLSx509CommandLine

Callers need to know the alias anyways so it does not make much sense to
generate it inside of this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Don't generate alias for TLS private key password secret
Peter Krempa [Tue, 29 May 2018 16:04:42 +0000 (18:04 +0200)]
qemu: command: Don't generate alias for TLS private key password secret

qemuBuildTLSx509CommandLine has no business guessing which alias should
be used. The alias needs to be passed in.

Note that there's a lingering bad design of this, since the secret
object alias is based on the device name and not on the fact that the
secret is used for decrypting of the TLS private key. If we ever add
authentication for chardevs this will bite us.

Thankfully disk code does not support encrypted private keys for TLS so
it can be happily refactored there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Set up disk TLS alias when preparing TLS setup
Peter Krempa [Tue, 29 May 2018 15:42:23 +0000 (17:42 +0200)]
qemu: domain: Set up disk TLS alias when preparing TLS setup

Move the TLS object alias setup earlier. Also make sure that the alias
is not overwritten on hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Allow passing in NULL 'tlsAlias' to qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 16:30:10 +0000 (18:30 +0200)]
qemu: hotplug: Allow passing in NULL 'tlsAlias' to qemuDomainGetTLSObjects

Some callers will not need to generate the alias again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Don't mandate passing of 'secAlias' in qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 18:06:35 +0000 (20:06 +0200)]
qemu: hotplug: Don't mandate passing of 'secAlias' in qemuDomainGetTLSObjects

For some reason the function returned an error if secAlias was not
passed in. It's not an error, in fact it's desired.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Don't encode matrix of storage protocols supporting TLS in the parser
Peter Krempa [Wed, 30 May 2018 09:03:28 +0000 (11:03 +0200)]
conf: Don't encode matrix of storage protocols supporting TLS in the parser

Always parse the 'tls' source field and let the drivers decide whether
they support it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Forbid TLS setup for disk protocols not supporting it
Peter Krempa [Wed, 30 May 2018 10:50:44 +0000 (12:50 +0200)]
qemu: domain: Forbid TLS setup for disk protocols not supporting it

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Use switch statement in qemuDomainPrepareDiskSourceTLS
Peter Krempa [Tue, 29 May 2018 11:45:18 +0000 (13:45 +0200)]
qemu: domain: Use switch statement in qemuDomainPrepareDiskSourceTLS

Select protocol using a switch with all cases enumerated. This will
simplify checking unsupported protocols and adding new support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Process only one object in qemuDomainPrepareDiskSourceTLS
Peter Krempa [Wed, 30 May 2018 10:48:34 +0000 (12:48 +0200)]
qemu: domain: Process only one object in qemuDomainPrepareDiskSourceTLS

Remove the loop from qemuDomainPrepareDiskSourceTLS and rename it to
qemuDomainPrepareStorageSourceTLS. Currently there is no backing chain
to prepare so fixing one device is equivalent. In the future it will be
reused in a function which will do the looping.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Separate setup of TLS for VXHS disks from qemuDomainPrepareDiskSourceTLS
Peter Krempa [Tue, 29 May 2018 11:40:16 +0000 (13:40 +0200)]
qemu: domain: Separate setup of TLS for VXHS disks from qemuDomainPrepareDiskSourceTLS

Split out the code into a separate function so that all steps for a
storage protocol are contained and the original function is easily
extendable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: aggregate setup of disk drive options for -drive
Peter Krempa [Tue, 29 May 2018 14:38:50 +0000 (16:38 +0200)]
qemu: domain: aggregate setup of disk drive options for -drive

When using blockdev the approach to base aliases will change. Add a
helper function that will aggregate all code which needs to be called
with the disk alias for the -drive to setup internal data.

qemuDomainSecretDiskPrepare wrapper is no longer necessary as the
contents were moved to a function which is designed to use the old
aliases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Split validation and setup of the virStorageSource
Peter Krempa [Tue, 29 May 2018 15:28:11 +0000 (17:28 +0200)]
qemu: domain: Split validation and setup of the virStorageSource

Remove the call to the validating function from the function which sets
stuff up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: don't loop through images in qemuDomainPrepareDiskSourceChain
Peter Krempa [Tue, 29 May 2018 15:05:05 +0000 (17:05 +0200)]
qemu: domain: don't loop through images in qemuDomainPrepareDiskSourceChain

Convert the function to just prepare data for the disk. Callers need to
do the looping since there's more to do than just copy the data around.

The code path in qemuDomainPrepareDiskSource doesn't need to loop over
the chain yet, since there currently is no chain at this point. This
will be addressed later in the blockdev series where we will setup much
more stuff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Properly setup data relevant for top disk image
Peter Krempa [Tue, 29 May 2018 14:52:17 +0000 (16:52 +0200)]
qemu: domain: Properly setup data relevant for top disk image

qemuDomainPrepareDiskSourceChain should set up the disk zero detection
mode only for the top level image. Since it's invoked also for the
middle of the chain we need to check that it's really only the top level
image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Regenerate alias for the TLS x509 credential object
Peter Krempa [Wed, 30 May 2018 10:18:37 +0000 (12:18 +0200)]
qemu: domain: Regenerate alias for the TLS x509 credential object

When restarting libvirt would previously lose the alias of the x509
certificate object. Upon unplug we would then not delete the
corresponding objects.

Restore the alias if we know it should be there.

Luckily for disks we don't support encrypted TLS environment, so there's
no need to regenerate the 'secret' alias for decryption.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Store and restore TLS object alias of a disk
Peter Krempa [Wed, 30 May 2018 10:03:41 +0000 (12:03 +0200)]
qemu: domain: Store and restore TLS object alias of a disk

Libvirt uses the stored alias to detach the TLS x509 object on disk
unplug. As the alias was not stored, the object would not be detached
if unplugging disks after libvirtd restart.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Use 'tlsAlias' to see whether to detach the disk
Peter Krempa [Wed, 30 May 2018 09:33:13 +0000 (11:33 +0200)]
qemu: hotplug: Use 'tlsAlias' to see whether to detach the disk

Using 'haveTLS' to do this is pointless if the alias is not set.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Don't try to infer secret object alias/presence
Peter Krempa [Mon, 28 May 2018 13:15:16 +0000 (15:15 +0200)]
qemu: hotplug: Don't try to infer secret object alias/presence

Now that we remember the alias we've used to attach the secret objects
we should reuse them rather than trying to infer them from the disk
configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Regenerate auth/enc secret aliases when restoring status XML
Peter Krempa [Thu, 24 May 2018 16:24:13 +0000 (18:24 +0200)]
qemu: domain: Regenerate auth/enc secret aliases when restoring status XML

Previously we did not store the aliases but rather re-generated them
when unplug was necessary. This is very cumbersome since the knowledge
when and which alias to use needs to be stored in the hotplug code as
well.

While this patch will not strictly improve this situation since there
still will be two places containing this code it at least will allow to
remove the mess from the disk-unplug code and will prevent introducing
more mess when adding blockdev support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemustatusxml2xml: Add test data for re-generating LUKS/auth aliases
Peter Krempa [Mon, 28 May 2018 08:02:54 +0000 (10:02 +0200)]
tests: qemustatusxml2xml: Add test data for re-generating LUKS/auth aliases

Add tests for upcoming re-generation of aliases for the secret objects
used by qemu when upgrading libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Store and parse disk authentication and encryption secret alias
Peter Krempa [Thu, 24 May 2018 11:55:16 +0000 (13:55 +0200)]
qemu: Store and parse disk authentication and encryption secret alias

Rather than trying to figure out which alias was used, store it in the
status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Don't delete aliases of secret objects associated with disks
Peter Krempa [Mon, 28 May 2018 13:31:42 +0000 (15:31 +0200)]
qemu: domain: Don't delete aliases of secret objects associated with disks

We need to reference the secret objects by name when hot-unplugging
disks. Don't remove the alias so that it does not need to be
recalculated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Add helpers for partially clearing qemuDomainSecretInfoPtr
Peter Krempa [Mon, 28 May 2018 13:17:01 +0000 (15:17 +0200)]
qemu: domain: Add helpers for partially clearing qemuDomainSecretInfoPtr

It's desired to keep the alias around to allow referencing of the secret
object used with qemu. Add set of APIs which will destroy all data
except the alias.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Use qemuDomainSecretInfoNewPlain only for unencrypted secrets
Peter Krempa [Tue, 22 May 2018 15:34:11 +0000 (17:34 +0200)]
qemu: domain: Use qemuDomainSecretInfoNewPlain only for unencrypted secrets

Move the logic that determines which secret shall be used into the
caller and make this function work only for plain secrets.

This untangles the control flow by only checking relevant data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Setup disk encryption password secret via new helper
Peter Krempa [Tue, 22 May 2018 15:18:06 +0000 (17:18 +0200)]
qemu: domain: Setup disk encryption password secret via new helper

The encryption secret is setup only for LUKS and thus requires the new
approach. Use qemuDomainSecretInfoNew for initializing it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Add new function to set up encrypted secrets only
Peter Krempa [Tue, 22 May 2018 15:14:10 +0000 (17:14 +0200)]
qemu: domain: Add new function to set up encrypted secrets only

Some code paths can't use the unencrypted secret. Add a helper which
checks and sets up an encrypted secret only and reuse it when setting up
the secret to decrypt the TLS private key in qemuDomainSecretInfoTLSNew.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Rename and fix docs for qemuDomainSecretInfoNew
Peter Krempa [Tue, 22 May 2018 11:08:19 +0000 (13:08 +0200)]
qemu: domain: Rename and fix docs for qemuDomainSecretInfoNew

Rename it to qemuDomainSecretInfoNewPlain and annotate that it also may
set up a 'plain' secret in some cases. This will eventually be
refactored further.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Rename qemuDomainSecretDiskCapable
Peter Krempa [Tue, 22 May 2018 07:18:34 +0000 (09:18 +0200)]
qemu: domain: Rename qemuDomainSecretDiskCapable

The function checks whether the storage source requires authentication
secret setup. Rename it accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Reuse code when preparing hostdev auth secrets
Peter Krempa [Tue, 22 May 2018 07:03:02 +0000 (09:03 +0200)]
qemu: domain: Reuse code when preparing hostdev auth secrets

Use qemuDomainSecretStorageSourcePrepare in
qemuDomainSecretHostdevPrepare as it uses a virStorageSource to prepare
the authentication secret object data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Add helper to check if encrypted secrets can be used with a VM
Peter Krempa [Tue, 22 May 2018 14:36:20 +0000 (16:36 +0200)]
qemu: domain: Add helper to check if encrypted secrets can be used with a VM

This helper checks that the vm has the master key setup and libvirt
supports the given encryption algorithm.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemublock: Switch to qcow2+luks in test files
Peter Krempa [Tue, 22 May 2018 13:03:02 +0000 (15:03 +0200)]
tests: qemublock: Switch to qcow2+luks in test files

The next patch will forbid the old qcow2 encryption completely. Remove
it from the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Verify that disk secret alias is correct with user-aliases
Peter Krempa [Wed, 23 May 2018 14:00:33 +0000 (16:00 +0200)]
tests: qemuxml2argv: Verify that disk secret alias is correct with user-aliases

Change the disk encryption type to qcow2+luks so that the appropriate
secret objects are generated. This tests that the proper alias is used
for the passphrase secret object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Drop disk encryption from 'interface-server' test
Peter Krempa [Wed, 23 May 2018 13:57:39 +0000 (15:57 +0200)]
tests: qemuxml2argv: Drop disk encryption from 'interface-server' test

The disk encryption part is no way relevant to the rest of the test so
drop it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: implement vsock coldplug/coldunplug
Ján Tomko [Wed, 30 May 2018 14:49:06 +0000 (16:49 +0200)]
qemu: implement vsock coldplug/coldunplug

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: implement vsock hotunplug
Ján Tomko [Wed, 30 May 2018 10:49:04 +0000 (12:49 +0200)]
qemu: implement vsock hotunplug

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: introduce virDomainVsockDefEquals
Ján Tomko [Wed, 30 May 2018 13:52:28 +0000 (15:52 +0200)]
conf: introduce virDomainVsockDefEquals

Introduce a function for comparing two vsock definitions.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: implement vsock hotplug
Ján Tomko [Wed, 30 May 2018 11:53:52 +0000 (13:53 +0200)]
qemu: implement vsock hotplug

Allow hotplugging the vsock device.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Add prefix for vsock vhostfd
Ján Tomko [Wed, 30 May 2018 10:52:51 +0000 (12:52 +0200)]
qemu: Add prefix for vsock vhostfd

Alter qemuBuildVsockDevStr to allow passing a prefix for
the vhostfd file descriptor name. Domain startup uses
the numeric value of fd without a prefix, but hotplug
will need to use a prefix because passed file descriptor
names cannot start with a number.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: split out qemuBuildVsockDevStr
Ján Tomko [Wed, 30 May 2018 10:48:26 +0000 (12:48 +0200)]
qemu: split out qemuBuildVsockDevStr

Split out the device string building to allow reuse for hotplug.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotests: xmconfigtest: add tests for cmdline formating osstest/frozen/xen-4.10-testing osstest/frozen/xen-4.11-testing osstest/frozen/xen-4.9-testing
Jim Fehlig [Wed, 23 May 2018 21:09:45 +0000 (15:09 -0600)]
tests: xmconfigtest: add tests for cmdline formating

Commit 656151bf fixed formatting of the <cmdline> element. Perhaps it
would have been noticed and fixed earlier if we had a test. With this
change, all possible cases of formatting <cmdline> from xmconfig are
covered

1. no 'extra=' or 'root=' in xm.cfg
2. 'extra=' but no 'root=' in xm.cfg
3. 'root=' but no 'extra=' in xm.cfg
4. both 'root=' and 'extra=' in xm.cfg

Case 1 is covered by all existing paravirt tests since they have no
'extra=' or 'root='. Case 2 is covered by adding 'extra=' to a few
of the existing paravirt tests. Cases 3 and 4 are covered by new
tests that only test conversion of xm.cfg to xml.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolibxl: fix leaking logfile fds
Jim Fehlig [Thu, 31 May 2018 21:41:37 +0000 (15:41 -0600)]
libxl: fix leaking logfile fds

Per-domain log files were introduced in commit a30b08b7179. The FILE
objects associated with these log files are stored in a hash table
using domid as a key. When a domain is shutdown, destroyed, or
otherwise powered-off, the FILE object is removed from the hash table,
where the free function will close the FILE.

Unfortunately the call to remove the FILE from the hash table occurs
after setting domid=-1 in the libxlDomainCleanup() function. The
object is never removed from the hash table, the free function is
never called, and the underlying fd is leaked. Fix by removing the
FILE object from the hash table before setting domid=-1.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoPost-release version bump to 4.5.0
Jiri Denemark [Mon, 4 Jun 2018 21:12:48 +0000 (23:12 +0200)]
Post-release version bump to 4.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoRelease of libvirt-4.4.0
Daniel Veillard [Mon, 4 Jun 2018 20:15:56 +0000 (22:15 +0200)]
Release of libvirt-4.4.0

* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agoqemu: check for QEMU_CAPS_DEVICE_VHOST_VSOCK
Ján Tomko [Mon, 4 Jun 2018 17:37:20 +0000 (19:37 +0200)]
qemu: check for QEMU_CAPS_DEVICE_VHOST_VSOCK

My commit b8b42ca added support for formatting the vsock
command line without actually checking if it's supported.

Add it to the per-device validation function.

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

Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agodocs: Use proper article in formatdomain.html.in
Martin Kletzander [Mon, 4 Jun 2018 13:33:19 +0000 (15:33 +0200)]
docs: Use proper article in formatdomain.html.in

It's "a hard_limit", not "an hard_limit".  Probably that was just a typo.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
6 years agoqemu: Fix reporting completed migration stats on destination
Jiri Denemark [Fri, 1 Jun 2018 08:32:49 +0000 (10:32 +0200)]
qemu: Fix reporting completed migration stats on destination

This has been broken since commit v4.0.0-165-g93412bb827 which added
jobInfo->statsType enum to distinguish various statistics types. During
migration the type will always be QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION,
however the destination code consuming the statistics data from
migration cookie failed to properly set the type. So even though
everything was filled in, the type remained *_NONE and any attempt to
fetch the statistics data of a completed migration on the destination
host failed.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agospec: Fix requirement for "tc" on new distros
Jiri Denemark [Fri, 1 Jun 2018 11:40:42 +0000 (13:40 +0200)]
spec: Fix requirement for "tc" on new distros

At least since Fedora 26 (maybe earlier, but we don't support older
Fedora releases), the "tc" tool is provided by a separate iproute-tc
package.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agonews: add vsock
Ján Tomko [Fri, 1 Jun 2018 11:32:00 +0000 (13:32 +0200)]
news: add vsock

Document the addition of vsock.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agoconf: rename <vsock><source> to <vsock><cid>
Ján Tomko [Fri, 1 Jun 2018 11:22:56 +0000 (13:22 +0200)]
conf: rename <vsock><source> to <vsock><cid>

To avoid the <source> vs. <target> confusion,
change <source auto='no' cid='3'/> to:
<cid auto='no' address='3'/>

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonews: Document two new features introduced in this release
Michal Privoznik [Fri, 1 Jun 2018 07:45:31 +0000 (09:45 +0200)]
news: Document two new features introduced in this release

The first feature is SCSI persistent reservation, the other is
support for multihead screenshots.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Fix detach of disk with managed persistent reservations
Peter Krempa [Thu, 31 May 2018 13:18:20 +0000 (15:18 +0200)]
qemu: hotplug: Fix detach of disk with managed persistent reservations

In commit 8bebb2b735d I've refactored how the detach of disk with a
managed persistent reservations object is handled. After the commit if
any disk with a managed PR object would be removed libvirt would also
attempt to remove the shared 'pr-manager-helper' object potentially used
by other disks.

Thankfully this should not have practical impact as qemu should reject
deletion of the object if it was still used and the rest of the code is
correct.

Fix this by removing the disk from the definition earlier and checking
if the shared/managed pr-manager-helper object is still needed.

This basically splits the detach code for the managed PR object from the
unmanaged ones. The same separation will follow for the attachment code
as well as it greatly simplifies -blockdev support for this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotestUpdateQEMUCaps: Don't leak host cpuData
Michal Privoznik [Thu, 31 May 2018 10:00:41 +0000 (12:00 +0200)]
testUpdateQEMUCaps: Don't leak host cpuData

When preparing qemuCaps for test cases the following is
happening:

qemuTestParseCapabilitiesArch() is called, which calls
virQEMUCapsLoadCache() which in turn calls
virQEMUCapsInitHostCPUModel() which sets qemuCaps->kvmCPU and
qemuCaps->tcgCPU.

But then the code tries to update the capabilities:

testCompareXMLToArgv() calls testUpdateQEMUCaps() which calls
virQEMUCapsInitHostCPUModel() again overwriting previously
allocated memory. The solution is to free host cpuData in
testUpdateQEMUCaps().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoconf: fixup USB input bus check
Xiao Feng Ren [Thu, 31 May 2018 09:11:58 +0000 (11:11 +0200)]
conf: fixup USB input bus check

This patch fixes the USB input bus check, the bug was introduced by commit 317badb

Signed-off-by: Xiao Feng Ren <renxiaof@linux.vnet.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoaudit: Enforce enum switch type cast in virDomainAuditHostdev
Erik Skultety [Thu, 31 May 2018 07:42:58 +0000 (09:42 +0200)]
audit: Enforce enum switch type cast in virDomainAuditHostdev

There was a missing enum for mdev causing a strange 'unknown device type'
warning when hot-plugging mdev.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemuxml2argvtest: Don't initialize qemuCaps twice
Michal Privoznik [Wed, 30 May 2018 15:51:59 +0000 (17:51 +0200)]
qemuxml2argvtest: Don't initialize qemuCaps twice

There's no point in calling testInitQEMUCaps() (which sets
info.qemuCaps) only to overwrite (and leak) it on the very next
line.

==12962== 296 (208 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 265 of 331
==12962==    at 0x4C2CF26: calloc (vg_replace_malloc.c:711)
==12962==    by 0x5D28D9F: virAllocVar (viralloc.c:560)
==12962==    by 0x5D96AB4: virObjectNew (virobject.c:239)
==12962==    by 0x56DB7C7: virQEMUCapsNew (qemu_capabilities.c:1480)
==12962==    by 0x112A5B: testInitQEMUCaps (qemuxml2argvtest.c:361)
==12962==    by 0x1371C8: mymain (qemuxml2argvtest.c:2871)
==12962==    by 0x13AD0B: virTestMain (testutils.c:1120)
==12962==    by 0x1372FD: main (qemuxml2argvtest.c:2883)

Removing the function call renders @gic argument unused therefore
it's removed from the macro (and all its callers).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirDomainDefParseXML: Free @tmp when parsing genid
Michal Privoznik [Wed, 30 May 2018 15:50:30 +0000 (17:50 +0200)]
virDomainDefParseXML: Free @tmp when parsing genid

We need to free return value of virXPathString().

==12962== 37 bytes in 1 blocks are definitely lost in loss record 156 of 331
==12962==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==12962==    by 0x91E8439: strdup (in /lib64/libc-2.25.so)
==12962==    by 0x5DBD551: virStrdup (virstring.c:977)
==12962==    by 0x5DD3E5E: virXPathString (virxml.c:84)
==12962==    by 0x5E178AB: virDomainDefParseXML (domain_conf.c:19110)
==12962==    by 0x5E1E985: virDomainDefParseNode (domain_conf.c:20885)
==12962==    by 0x5E1E7CB: virDomainDefParse (domain_conf.c:20827)
==12962==    by 0x5E1E871: virDomainDefParseFile (domain_conf.c:20853)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoconf: fix vsock memory leaks
Ján Tomko [Wed, 30 May 2018 13:52:18 +0000 (15:52 +0200)]
conf: fix vsock memory leaks

Introduced by:
commit d4abb7b45d48aba77c2464dbea95f02a43a60834
    conf: introduce <vsock> element
commit b8b42ca036adbfaac1741c8efe389cd1403e220b
    qemu: add support for vhost-vsock-pci

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: free migEvent in qemuMigrationCapsCheck
Ján Tomko [Wed, 30 May 2018 13:52:50 +0000 (15:52 +0200)]
qemu: free migEvent in qemuMigrationCapsCheck

We allocate a temporary bitmap but never free it.

Introduced by <commit 1f8a1a9>:
    qemu: Do not use qemuMonitorSetMigrationCapability

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: initialize some variables
Ján Tomko [Mon, 28 May 2018 07:05:29 +0000 (09:05 +0200)]
tests: initialize some variables

Found by cppcheck:
[tests/metadatatest.c:284]: (error) Uninitialized variable: test
[tests/objecteventtest.c:855]: (error) Uninitialized variable: test

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agospec: Fix permissions of nwfilter XMLs
Jiri Denemark [Tue, 29 May 2018 20:30:33 +0000 (22:30 +0200)]
spec: Fix permissions of nwfilter XMLs

The nwfilter XMLs in /etc are defined as %ghost in the spec file, which
means rpm will not install them, but it will record its existence and
permissions in the database. During installation the files are copied in
a %post scriptlet from /usr/share/libvirt/nwfilter, but once libvirtd is
restarted, it will rewrite the files to add generated UUIDs.

While RPM recorded 644 mode for the XMLs, libvirt saves them with 600
and thus any future attempt to verify the libvirt-daemon-config-nwfilter
package would fail. We need to tell RPM the ghost files are supposed to
have 600 permissions.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agostorage: Add capability to use LUKS encryption for disk backend
John Ferlan [Mon, 21 May 2018 10:40:58 +0000 (06:40 -0400)]
storage: Add capability to use LUKS encryption for disk backend

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

Similar to the the Logical backend, use qemu-img on the created
disk partition device to set up for LUKS encryption. Secret mgmt
for the device can be complicated by a reboot possibly changing
the path to the device if the infrastructure changes.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: add support for vhost-vsock-pci
Ján Tomko [Tue, 22 May 2018 13:57:47 +0000 (15:57 +0200)]
qemu: add support for vhost-vsock-pci

Create a new vsock endpoint by opening /dev/vhost-vsock,
set the requested CID via ioctl (or assign a free one if auto='yes'),
pass the file descriptor to QEMU and build the command line.

https://bugzilla.redhat.com/show_bug.cgi?id=1291851
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: create virvsock.c
Ján Tomko [Tue, 22 May 2018 13:52:52 +0000 (15:52 +0200)]
util: create virvsock.c

A file for vsock-related helper functions.
virVsockSetGuestCid to set an already-known CID,
virVsockAcquireGuestCid that will use the first available CID

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoIntroduce QEMU_CAPS_DEVICE_VHOST_VSOCK
Ján Tomko [Wed, 1 Nov 2017 15:13:27 +0000 (16:13 +0100)]
Introduce QEMU_CAPS_DEVICE_VHOST_VSOCK

Add a new capability flag for vhost-vsock-device

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: add private data for vsock
Ján Tomko [Fri, 18 May 2018 11:14:42 +0000 (13:14 +0200)]
qemu: add private data for vsock

Introduce a structure and a class that will be used to store
the private data.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: introduce <vsock> element
Ján Tomko [Tue, 22 May 2018 09:21:15 +0000 (11:21 +0200)]
conf: introduce <vsock> element

Add a new 'vsock' element for the vsock device.
The 'model' attribute is optional.
A <source cid> subelement should be used to specify the guest cid,
or <source auto='yes'/> should be used.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: add privateData to virDomainVsockDef
Ján Tomko [Thu, 17 May 2018 14:58:24 +0000 (16:58 +0200)]
conf: add privateData to virDomainVsockDef

An object for storing driver-specific data in the vsock definition.

https://bugzilla.redhat.com/show_bug.cgi?id=1291851
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoIntroduce virDomainVsockDef
Ján Tomko [Tue, 22 May 2018 08:37:50 +0000 (10:37 +0200)]
Introduce virDomainVsockDef

A type to represent the new vsock device.
Also implement an allocation function to allow future addition
of private data.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Remove rwlocks during virStoragePoolObjListForEach
John Ferlan [Thu, 24 May 2018 19:38:18 +0000 (15:38 -0400)]
storage: Remove rwlocks during virStoragePoolObjListForEach

Remove the locks since they are unnecessary and would cause
a hang for a driver reload/restart when a transient pool was
previously active as a result of the call:

virStoragePoolUpdateInactive:
...
    if (!virStoragePoolObjGetConfigFile(obj)) {
        virStoragePoolObjRemove(driver->pools, obj);
...

stack trace:

Thread 17 (Thread 0x7fffcc574700 (LWP 12465)):
...pthread_rwlock_wrlock
...virRWLockWrite
...virObjectRWLockWrite
...virStoragePoolObjRemove
...virStoragePoolUpdateInactive
...storagePoolUpdateStateCallback
...virStoragePoolObjListForEachCb
...virHashForEach
...virStoragePoolObjListForEach
...storagePoolUpdateAllState
...storageStateInitialize
...virStateInitialize
...daemonRunStateInit
...virThreadHelper
...start_thread
...clone

Introduced by commit id 4b2e0ed6e3.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: domain: Pass 'qemuCaps' to post parse callbacks when parsing status XML
Peter Krempa [Mon, 28 May 2018 09:36:47 +0000 (11:36 +0200)]
qemu: domain: Pass 'qemuCaps' to post parse callbacks when parsing status XML

When status XML was parsed the post-parse callbacks could not access
qemu caps and potentially upgrade the definition according to the
present caps. Implement the callback to pass it in.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoconf: domain: Allow passing in 'parseOpaque' for post-parse of status XML
Peter Krempa [Mon, 28 May 2018 09:36:46 +0000 (11:36 +0200)]
conf: domain: Allow passing in 'parseOpaque' for post-parse of status XML

The status XML parser function virDomainObjParseXML could not pass in
parseOpaque into the post parse callbacks. Add a callback which will
allow hypervisor drivers to fill it from the 'virDomainObj' data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoconf: domain: Invoke post-parse callbacks after parsing private XML parts
Peter Krempa [Mon, 28 May 2018 09:36:45 +0000 (11:36 +0200)]
conf: domain: Invoke post-parse callbacks after parsing private XML parts

When parsing status XML the post-parse callbacks can't access any
private data present in the status XML as the private bits were parsed
after invoking post-parse callbacks.

Move the invocation so that everything is parsed first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoconf: remove 'bootHash' completely
Ján Tomko [Mon, 28 May 2018 12:34:51 +0000 (14:34 +0200)]
conf: remove 'bootHash' completely

Its only use is now to check for duplicate boot order values,
which is now also done in virDomainDefPostParseCommon.

Remove it completely.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: remove 'bootHash' from the post-parse infrastructure
Peter Krempa [Mon, 28 May 2018 09:36:44 +0000 (11:36 +0200)]
conf: remove 'bootHash' from the post-parse infrastructure

As the function signature of virDomainDefPostParseInternal does not
differ from virDomainDefPostParse now, the wrapper can be dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: introduce virDomainDefBootOrderPostParse
Ján Tomko [Mon, 28 May 2018 12:31:50 +0000 (14:31 +0200)]
conf: introduce virDomainDefBootOrderPostParse

Move the check for boot elements into a separate function
and remove its dependency on the parser-supplied bootHash table.

Reconstructing the hash table from the domain definition
effectively duplicates the check for duplicate boot order
values, also present in virDomainDeviceBootParseXML.

Now it will also be run on domains created by other means than XML
parsing, since it will be run even for code paths that did not supply
the bootHash table before.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovmx: add VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER
Ján Tomko [Mon, 28 May 2018 13:16:16 +0000 (15:16 +0200)]
vmx: add VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER

Further patches will introduce validation and a default setting
of def->os.bootDevs in postParse.

Introduce a feature flag to opt out of this and set it in the vmx
driver, otherwise we would be adding it <boot dev='hd'/> into every
vmx config despite having no way to change it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Don't build cache= cmd line for scsi-block
Michal Privoznik [Mon, 28 May 2018 14:28:09 +0000 (16:28 +0200)]
qemu: Don't build cache= cmd line for scsi-block

Trying to set any cache for <disk device='lun'/> makes no sense.
Such disk translates into -device scsi-block on the command line
and the device lacks any cache setting because it's merely a
middle man between qemu and real SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agonews: Mention new CPU related APIs
Jiri Denemark [Wed, 16 May 2018 08:05:57 +0000 (10:05 +0200)]
news: Mention new CPU related APIs

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Implement virConnectBaselineHypervisorCPU
Jiri Denemark [Fri, 11 May 2018 11:33:19 +0000 (13:33 +0200)]
qemu: Implement virConnectBaselineHypervisorCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agoqemu_capabilities: Introduce virQEMUCapsGetCPUFeatures
Jiri Denemark [Tue, 15 May 2018 20:03:19 +0000 (22:03 +0200)]
qemu_capabilities: Introduce virQEMUCapsGetCPUFeatures

The function creates a list of all (or migratable only) CPU features
supported by QEMU. It works by looking at the CPU model info returned by
query-cpu-model-expansion QMP command.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agocpu: Add optional list of allowed features to virCPUBaseline
Jiri Denemark [Tue, 15 May 2018 09:57:35 +0000 (11:57 +0200)]
cpu: Add optional list of allowed features to virCPUBaseline

When computing a baseline CPU for a specific hypervisor we have to make
sure to include only CPU features supported by the hypervisor. Otherwise
the computed CPU could not be used for starting a new domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agocpu: Update style in virCPUBaseline
Jiri Denemark [Tue, 15 May 2018 09:04:10 +0000 (11:04 +0200)]
cpu: Update style in virCPUBaseline

To make it more consistent with the rest of the CPU driver code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agocpu: Add explicit arch parameter for virCPUBaseline
Jiri Denemark [Tue, 15 May 2018 08:59:50 +0000 (10:59 +0200)]
cpu: Add explicit arch parameter for virCPUBaseline

This is required for virCPUBaseline to accept a list of guest CPU
definitions since they do not have arch set.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agocpu_x86: Add support for passing guest CPUs to virCPUx86Baseline
Jiri Denemark [Tue, 15 May 2018 09:27:20 +0000 (11:27 +0200)]
cpu_x86: Add support for passing guest CPUs to virCPUx86Baseline

Modern host CPU models from domain capabilities XMLs are reported as
guest CPU definitions with feature policies. This patch updates
virCPUx86Baseline to properly handle such CPU models.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agocpu: Rename cpuBaseline as virCPUBaseline
Jiri Denemark [Tue, 15 May 2018 08:50:32 +0000 (10:50 +0200)]
cpu: Rename cpuBaseline as virCPUBaseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: Introduce new hypervisor-cpu-baseline command
Jiri Denemark [Mon, 7 May 2018 13:10:52 +0000 (15:10 +0200)]
virsh: Introduce new hypervisor-cpu-baseline command

This command is a virsh wrapper for virConnectBaselineHypervisorCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoremote: Implement virConnectBaselineHypervisorCPU
Jiri Denemark [Wed, 25 Apr 2018 11:43:24 +0000 (13:43 +0200)]
remote: Implement virConnectBaselineHypervisorCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoIntroduce virConnectBaselineHypervisorCPU public API
Jiri Denemark [Tue, 24 Apr 2018 21:33:28 +0000 (23:33 +0200)]
Introduce virConnectBaselineHypervisorCPU public API

The new API computes the most feature-rich CPU which is compatible with
all given CPUs and can be provided by the specified hypervisor. It is a
more useful version of virConnectBaselineCPU, which doesn't consider any
hypervisor capabilities when computing the best CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agoqemu: Implement virConnectCompareHypervisorCPU
Jiri Denemark [Wed, 9 May 2018 12:06:46 +0000 (14:06 +0200)]
qemu: Implement virConnectCompareHypervisorCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: Introduce new hypervisor-cpu-compare command
Jiri Denemark [Mon, 30 Apr 2018 12:48:03 +0000 (14:48 +0200)]
virsh: Introduce new hypervisor-cpu-compare command

This command is a virsh wrapper for virConnectCompareHypervisorCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agoremote: Implement virConnectCompareHypervisorCPU
Jiri Denemark [Tue, 24 Apr 2018 20:19:03 +0000 (22:19 +0200)]
remote: Implement virConnectCompareHypervisorCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoIntroduce virConnectCompareHypervisorCPU public API
Jiri Denemark [Tue, 24 Apr 2018 19:31:33 +0000 (21:31 +0200)]
Introduce virConnectCompareHypervisorCPU public API

This new API compares the given CPU description with the CPU the
specified hypervisor is able to provide on the host. It is a more useful
version of virConnectCompareCPU, which compares the CPU definition with
the host CPU without considering any specific hypervisor and its
abilities.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
6 years agoqemu_capabilities: Introduce virQEMUCapsCacheLookupDefault
Jiri Denemark [Mon, 7 May 2018 20:51:57 +0000 (22:51 +0200)]
qemu_capabilities: Introduce virQEMUCapsCacheLookupDefault

virConnectGetDomainCapabilities needs to lookup QEMU capabilities
matching a specified binary, architecture, virt type, and machine type
while using default values when any of the parameters are not provided
by the user. Let's extract the lookup code into
virQEMUCapsCacheLookupDefault to make it reusable.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovshExtractCPUDefXML: Accept domain capabilities XML
Jiri Denemark [Fri, 4 May 2018 21:46:55 +0000 (23:46 +0200)]
vshExtractCPUDefXML: Accept domain capabilities XML

The domain capabilities XML contains host CPU model tailored to a
specific hypervisor and since it's enclosed in <mode name='host-model'>
element rather then the required <cpu> it's impossible to directly use
the host CPU model as an input to, e.g., cpu-compare command. To make
this more convenient, vshExtractCPUDefXML now accepts full domain
capabilities XML and automatically transforms the host CPU models into
the form accepted by libvirt APIs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoImprove documentation of virConnectGetCPUModelNames
Jiri Denemark [Fri, 11 May 2018 14:24:44 +0000 (16:24 +0200)]
Improve documentation of virConnectGetCPUModelNames

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: Enhance documentation of cpu-models command
Jiri Denemark [Mon, 14 May 2018 12:10:48 +0000 (14:10 +0200)]
virsh: Enhance documentation of cpu-models command

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>