]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoqemu: Alter VM Generation ID for specific startup/launch transitions
John Ferlan [Mon, 9 Apr 2018 14:31:17 +0000 (10:31 -0400)]
qemu: Alter VM Generation ID for specific startup/launch transitions

Before we generate the command line for qemu, if the domain about to
be launched desires to utilize the VM Generation ID functionality, then
handle both the regenerating the GUID value for backup recovery (restore
operation) and the startup after snapshot as both require a new GUID to
be generated to allow the guest operating system to recognize the VM
is re-executing something that has already executed before.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Add VM Generation ID device capability
John Ferlan [Fri, 16 Mar 2018 21:23:05 +0000 (17:23 -0400)]
qemu: Add VM Generation ID device capability

Add the query of the device objects for the vmgenid device

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoconf: Add VM Generation ID parse/format support
John Ferlan [Mon, 9 Apr 2018 16:10:02 +0000 (12:10 -0400)]
conf: Add VM Generation ID parse/format support

The VM Generation ID is a mechanism to provide a unique 128-bit,
cryptographically random, and integer value identifier known as
the GUID (Globally Unique Identifier) to the guest OS. The value
is used to help notify the guest operating system when the virtual
machine is executed with a different configuration.

This patch adds support for a new "genid" XML element similar to
the "uuid" element. The "genid" element can have two forms "<genid/>"
or "<genid>$GUID</genid>". If the $GUID is not provided, libvirt
will generate one and save it in the XML.

Since adding support for a generated GUID (or UUID like) value to
be displayed modifying the xml2xml test to include virrandommock.so
is necessary since it will generate a "known" value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agotools: virsh: Add virshCellnoCompleter.
Roland Schulz [Fri, 25 May 2018 07:12:37 +0000 (09:12 +0200)]
tools: virsh: Add virshCellnoCompleter.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agospec: Enable libssh on future RHEL
Jiri Denemark [Fri, 25 May 2018 07:45:15 +0000 (09:45 +0200)]
spec: Enable libssh on future RHEL

Future RHEL will certainly be modern enough to support libssh.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agonews: Add the event name completion
Lin Ma [Fri, 25 May 2018 05:41:12 +0000 (13:41 +0800)]
news: Add the event name completion

Signed-off-by: Lin Ma <lma@suse.com>
6 years agoqemu: domain: Use typecasted enum in qemuDomainDeviceDefPostParse
Peter Krempa [Thu, 24 May 2018 15:18:50 +0000 (17:18 +0200)]
qemu: domain: Use typecasted enum in qemuDomainDeviceDefPostParse

Rather than a lot of checks use a switch statement. This optimizes the
code as if one device is matched the rest will certainly not match.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Extract panic device def post parse code
Peter Krempa [Thu, 24 May 2018 15:01:55 +0000 (17:01 +0200)]
qemu: domain: Extract panic device def post parse code

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Extract video device def post parse code
Peter Krempa [Thu, 24 May 2018 15:01:55 +0000 (17:01 +0200)]
qemu: domain: Extract video device def post parse code

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Extract network device def post parse code
Peter Krempa [Thu, 24 May 2018 15:01:55 +0000 (17:01 +0200)]
qemu: domain: Extract network device def post parse code

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Extract disk post parse code into a function
Peter Krempa [Thu, 24 May 2018 14:55:20 +0000 (16:55 +0200)]
qemu: domain: Extract disk post parse code into a function

Later on, more stuff will be added so prevent the main function growing
out of control.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoFix indentation of virshAllocpagesPagesizeCompleter arguments.
Roland Schulz [Thu, 24 May 2018 09:04:33 +0000 (11:04 +0200)]
Fix indentation of virshAllocpagesPagesizeCompleter arguments.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
6 years agoAdd virshAllocpagesPagesizeCompleter to opts_freepages.
Roland Schulz [Thu, 24 May 2018 13:11:12 +0000 (15:11 +0200)]
Add virshAllocpagesPagesizeCompleter to opts_freepages.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
6 years agovirsh: Add event name completion to 'nodedev-event' command
Lin Ma [Wed, 23 May 2018 06:32:46 +0000 (14:32 +0800)]
virsh: Add event name completion to 'nodedev-event' command

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh-nodedev: Rename and move vshEventCallback to virshNodedevEventCallback
Lin Ma [Wed, 23 May 2018 06:32:45 +0000 (14:32 +0800)]
virsh-nodedev: Rename and move vshEventCallback to virshNodedevEventCallback

The next patch will use it in virsh-completer.c for returning the name
list of nodedev events.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Add event name completion to 'pool-event' command
Lin Ma [Thu, 24 May 2018 13:16:26 +0000 (15:16 +0200)]
virsh: Add event name completion to 'pool-event' command

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh-pool: Rename and move vshEventCallback to virshPoolEventCallback
Lin Ma [Thu, 24 May 2018 13:19:29 +0000 (15:19 +0200)]
virsh-pool: Rename and move vshEventCallback to virshPoolEventCallback

The next patch will use it in virsh-completer.c for returning the name
list of pool events.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Add event name completion to 'event' command
Lin Ma [Wed, 23 May 2018 06:32:42 +0000 (14:32 +0800)]
virsh: Add event name completion to 'event' command

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Move vshEventCallback structure definition to virsh-domain.h
Lin Ma [Wed, 23 May 2018 06:32:41 +0000 (14:32 +0800)]
virsh: Move vshEventCallback structure definition to virsh-domain.h

The next patch will use it in virsh-completer.c for returning the
strings of domain event name. At the same time, rename it to
avoid possible name clashing.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Add event name completion to 'secret-event' command
Lin Ma [Wed, 23 May 2018 06:32:40 +0000 (14:32 +0800)]
virsh: Add event name completion to 'secret-event' command

The patch code originally authored by Michal Privoznik, Please refer to
https://www.redhat.com/archives/libvir-list/2018-May/msg01022.html

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh-secret: Rename vshEventCallback to virshSecretEventCallback
Lin Ma [Wed, 23 May 2018 06:32:39 +0000 (14:32 +0800)]
virsh-secret: Rename vshEventCallback to virshSecretEventCallback

The next patch will use it in virsh-completer.c for returning the name
list of secret events.

The patch code originally authored by Michal Privoznik, Please refer to
https://www.redhat.com/archives/libvir-list/2018-May/msg01022.html

I splitted it to 2 patches with tiny change.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agonews: Add TLS non-shared storage migration
Peter Krempa [Wed, 23 May 2018 14:55:50 +0000 (16:55 +0200)]
news: Add TLS non-shared storage migration

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: monitor: Remove diskSecretLookup monitor event
Peter Krempa [Tue, 22 May 2018 13:43:28 +0000 (15:43 +0200)]
qemu: monitor: Remove diskSecretLookup monitor event

After the text monitor was deleted this event can't be triggered.
Remove it and all the unnecessary code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Remove dead code from text monitor
Peter Krempa [Tue, 22 May 2018 12:15:36 +0000 (14:15 +0200)]
qemu: monitor: Remove dead code from text monitor

Remove all unused functions and cleanup headers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Drop calls to text monitor impl where possible
Peter Krempa [Tue, 22 May 2018 11:51:36 +0000 (13:51 +0200)]
qemu: monitor: Drop calls to text monitor impl where possible

Drop all conditional calls which have JSON variants, now that we
guarantee JSON monitor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Drop JSON versions of savevm/delvm/loadvm
Peter Krempa [Tue, 22 May 2018 11:46:05 +0000 (13:46 +0200)]
qemu: monitor: Drop JSON versions of savevm/delvm/loadvm

qemu did not QAPIfy these and the design and name will most probably
change. The replacements will not be compatible. Drop the JSON stubs and
annotate that there won't be a replacement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Drop QEMU_CHECK_MONITOR_JSON... macros
Peter Krempa [Tue, 22 May 2018 11:23:34 +0000 (13:23 +0200)]
qemu: monitor: Drop QEMU_CHECK_MONITOR_JSON... macros

Monitor is now JSON only. Drop the old cruft.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Drop qemumonitortest
Peter Krempa [Tue, 22 May 2018 12:00:38 +0000 (14:00 +0200)]
tests: Drop qemumonitortest

We don't use the text monitor since we dropped support for pre-JSON
qemus. Drop the test so that we can later delete the text monitor
support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Remove unused qemuMonitor(Add|Remove)HostNetwork
Peter Krempa [Tue, 22 May 2018 11:36:28 +0000 (13:36 +0200)]
qemu: monitor: Remove unused qemuMonitor(Add|Remove)HostNetwork

There are no callers for these. Remove them and the monitor
implementations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Drop fallback to text monitor for 'send-key' command
Peter Krempa [Tue, 22 May 2018 11:13:03 +0000 (13:13 +0200)]
qemu: monitor: Drop fallback to text monitor for 'send-key' command

The QMP version was added in qemu commit e4c8f004c55d9da3eae3e14 which
is included in v1.3.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Drop fallback to text monitor for 'inject-nmi' command
Peter Krempa [Tue, 22 May 2018 11:13:03 +0000 (13:13 +0200)]
qemu: monitor: Drop fallback to text monitor for 'inject-nmi' command

The QMP version was added in qemu commit ab49ab5c488237f3656689 which
is included in v1.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest driver: Make test capabilities report more hugepages per each NUMA node
Roland Schulz [Wed, 23 May 2018 12:40:40 +0000 (14:40 +0200)]
test driver: Make test capabilities report more hugepages per each NUMA node

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoFix memory leak issues in virshAllocpagesPagesizeCompleter.
Roland Schulz [Wed, 23 May 2018 12:40:41 +0000 (14:40 +0200)]
Fix memory leak issues in virshAllocpagesPagesizeCompleter.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: migration: Add support for transporting NBD over TLS
Peter Krempa [Wed, 28 Feb 2018 14:20:17 +0000 (15:20 +0100)]
qemu: migration: Add support for transporting NBD over TLS

Implement the secure way to transport non-shared storage data across
migrations. The new approach uses blockdev-add to create the NBD client
so that the TLS secret object can be specified.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: migration: Extract code responsible for calling drive-mirror
Peter Krempa [Fri, 23 Feb 2018 09:29:08 +0000 (10:29 +0100)]
qemu: migration: Extract code responsible for calling drive-mirror

Separate the code relevant for this approach so that we can later add a
second implementation without making the function messy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: migration: Rename NBD migration functions
Peter Krempa [Thu, 22 Feb 2018 15:11:59 +0000 (16:11 +0100)]
qemu: migration: Rename NBD migration functions

Drop the mention of 'drive mirror' from the function names and mention
NBD. This will help when adding the 'blockdev mirror' migration code
which will allow using TLS.

Additionally fix some of the function comments to make more sense

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotest: Add status XML test for NBD tls storage migration
Peter Krempa [Mon, 12 Mar 2018 15:36:24 +0000 (16:36 +0100)]
test: Add status XML test for NBD tls storage migration

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: domain: Add private data for NBD migration storage source definition
Peter Krempa [Wed, 28 Feb 2018 14:22:30 +0000 (15:22 +0100)]
qemu: domain: Add private data for NBD migration storage source definition

Allow saving various aspects necessary to do NBD migration via blockdev
by storing a 'virStorageSource' in the disk private data meant to store
the NBD target of migration. Along with this add code to parse and
format it into the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: domain: Extract parsing of NBD status XML
Peter Krempa [Mon, 12 Mar 2018 14:33:39 +0000 (15:33 +0100)]
qemu: domain: Extract parsing of NBD status XML

Extract the NBD portion of the 'job' status XML element parser into a
separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: domain: Extract NBD disk migration private data formatting
Peter Krempa [Mon, 5 Mar 2018 16:00:44 +0000 (17:00 +0100)]
qemu: domain: Extract NBD disk migration private data formatting

We will be adding source data to it so extract it to a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: block: Add helpers for hot-adding virStorageSource via blockdev
Peter Krempa [Fri, 23 Feb 2018 11:59:13 +0000 (12:59 +0100)]
qemu: block: Add helpers for hot-adding virStorageSource via blockdev

These helpers add infrastructure which simplifies adding and rolling
back virStorageSources to a running qemu instance. Using of the helper
structure and separate functions allows for a much cleaner code in the
section dealing with the monitor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Introduce support for blockdev-mirror
Peter Krempa [Tue, 1 Mar 2016 13:55:34 +0000 (14:55 +0100)]
qemu: monitor: Introduce support for blockdev-mirror

drive-mirror allows only file targets. Introduce support for
blockdev-mirror that is able to copy to any BDS described by a node name
in qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Add implementation for blockdev-add and blockdev-del
Peter Krempa [Tue, 20 Feb 2018 17:04:47 +0000 (18:04 +0100)]
qemu: monitor: Add implementation for blockdev-add and blockdev-del

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Factor out and document code to format QMP command
Peter Krempa [Tue, 20 Feb 2018 16:56:46 +0000 (17:56 +0100)]
qemu: monitor: Factor out and document code to format QMP command

Move formatting of the qemu command out of qemuMonitorJSONMakeCommandRaw
to qemuMonitorJSONMakeCommandInternal to allow greater reusability and
document the function better.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: caps: Add capability for blockdev-add/blockdev-del
Peter Krempa [Thu, 29 Mar 2018 11:22:04 +0000 (13:22 +0200)]
qemu: caps: Add capability for blockdev-add/blockdev-del

The capability also represents that 'blockdev-add' is functional. It's
necessary to detect it via presence of 'blockdev-del' since blockdev-add
did not have the unsupported 'x-blockdev-add' version previously and
thus would be marked as present even if we could not use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: migration: Don't access disk members without lock
Peter Krempa [Fri, 23 Feb 2018 08:03:49 +0000 (09:03 +0100)]
qemu: migration: Don't access disk members without lock

The initiation of a synchronous block job in the NBD storage migration
code was placed after entering the monitor thus after the lock on the VM
object was unlocked. Thankfully nothing bad could happen in this
situation since the migration job prevents any disk detaches or other
modifications of the domain object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: domain: Export virDomainStorageSourceParse
Peter Krempa [Wed, 9 May 2018 14:21:55 +0000 (16:21 +0200)]
conf: domain: Export virDomainStorageSourceParse

It will be used when parsing the migration private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: block: Don't nest storage layer properties into format layer
Peter Krempa [Mon, 14 May 2018 11:54:12 +0000 (13:54 +0200)]
qemu: block: Don't nest storage layer properties into format layer

Reference the storage via node name rather than inlining it. This is
the approach that will be used with -blockdev/blockdev-add since it
allows more control and is more future proof.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agodocs: news: Add entry about the newly supported 'output' audio codec
Filip Alac [Tue, 22 May 2018 11:12:35 +0000 (13:12 +0200)]
docs: news: Add entry about the newly supported 'output' audio codec

Signed-off-by: Filip Alac <filipalac@gmail.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: qemu: Extend the test suite with the 'output' sound codec
Filip Alac [Tue, 22 May 2018 11:12:34 +0000 (13:12 +0200)]
tests: qemu: Extend the test suite with the 'output' sound codec

Affects qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Filip Alac <filipalac@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: capabilities: Add 'hda-output' sound codec to capabilities
Filip Alac [Tue, 22 May 2018 11:12:33 +0000 (13:12 +0200)]
qemu: capabilities: Add 'hda-output' sound codec to capabilities

Signed-off-by: Filip Alac <filipalac@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Introduce codec type 'output'
Filip Alac [Tue, 22 May 2018 11:12:32 +0000 (13:12 +0200)]
conf: Introduce codec type 'output'

Introduce support for codec type 'output' ('hda-output' in QEMU) for ich6
and ich9 sound devices, which only advertises a line-out in the guest.
This has been available in QEMU since 0.14.

Signed-off-by: Filip Alac <filipalac@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: only pass -sandbox off if supported
Ján Tomko [Fri, 18 May 2018 12:57:51 +0000 (14:57 +0200)]
qemu: only pass -sandbox off if supported

This way we don't rely on QEMU supplying the -sandbox option
without CONFIG_SECCOMP.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoReintroduce QEMU_CAPS_SECCOMP_SANDBOX
Ján Tomko [Fri, 18 May 2018 12:46:54 +0000 (14:46 +0200)]
Reintroduce QEMU_CAPS_SECCOMP_SANDBOX

Commit 766d5c1b deprecated the capability, because we were assuming
it for every QEMU binary. At the time of the introduction, there
was no way to probe for this via QMP.

However since QEMU 1.5.0 (which is the earliest version we support)
we can rely on the query-command-line-options command to detect this
feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Deny hugepages for non-existent NUMA nodes
Michal Privoznik [Fri, 18 May 2018 10:54:46 +0000 (12:54 +0200)]
qemu: Deny hugepages for non-existent NUMA nodes

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

Just like ec982f6d929f3c23 denies hugepages for non-existent
guest NUMA nodes in case there are some nodes configured.
Unfortunately, when there are none, qemuBuildNumaArgStr() is not
called and thus we have to have check in qemuBuildMemPathStr()
too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoAdd NUMA support to virshAllocpagesPagesizeCompleter.
Roland Schulz [Tue, 22 May 2018 09:54:44 +0000 (11:54 +0200)]
Add NUMA support to virshAllocpagesPagesizeCompleter.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agocpu: define the 'virt-ssbd' CPUID feature bit (CVE-2018-3639)
Daniel P. Berrangé [Mon, 21 May 2018 22:05:08 +0000 (23:05 +0100)]
cpu: define the 'virt-ssbd' CPUID feature bit (CVE-2018-3639)

Some AMD processors only support a non-architectural means of
enabling Speculative Store Bypass Disable. To allow simplified
handling in virtual environments, hypervisors will expose an
architectural definition through CPUID bit 0x80000008_EBX[25].
This needs to be exposed to guest OS running on AMD x86 hosts to
allow them to protect against CVE-2018-3639.

Note that since this CPUID bit won't be present in the host CPUID
results on physical hosts, it will not be enabled automatically
in guests configured with "host-model" CPU unless using QEMU
version >= 2.9.0. Thus for older versions of QEMU, this feature
must be manually enabled using policy=force. Guests using the
"host-passthrough" CPU mode do not need special handling.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agocpu: define the 'ssbd' CPUID feature bit (CVE-2018-3639)
Daniel P. Berrangé [Mon, 21 May 2018 22:05:07 +0000 (23:05 +0100)]
cpu: define the 'ssbd' CPUID feature bit (CVE-2018-3639)

New microcode introduces the "Speculative Store Bypass Disable"
CPUID feature bit. This needs to be exposed to guest OS to allow
them to protect against CVE-2018-3639.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agotools: Tiny clean-ups for two functions in virsh-completer.c
Martin Kletzander [Mon, 21 May 2018 09:00:01 +0000 (11:00 +0200)]
tools: Tiny clean-ups for two functions in virsh-completer.c

These two functions were duplicating some cleanup paths, so let's just merge
both cleanup and error paths together.  To distinguish whether we need to
clean-up the return value let's keep it in @tmp until the function is successful
in which case we set @ret to the value of @tmp and set @tmp to NULL.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotravis: Print test log file from distcheck as well
Martin Kletzander [Mon, 30 Apr 2018 17:49:07 +0000 (19:49 +0200)]
travis: Print test log file from distcheck as well

Since we started using `make distcheck` in travis, the part that's printing the
tests/test-suite.log file is rather pointless.  Let's check for both known
locations (keeping the previous one there on purpose) so that the output is
usable again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoAdd virshAllocpagesPagesizeCompleter
Roland Schulz [Mon, 21 May 2018 11:53:44 +0000 (13:53 +0200)]
Add virshAllocpagesPagesizeCompleter

Returns list of host page sizes from capabilities XML.

Signed-off-by: Roland Schulz <schullzroll@gmail.com>
6 years agoqemu: clarify message about block peek format restriction
Daniel P. Berrangé [Fri, 18 May 2018 15:12:29 +0000 (16:12 +0100)]
qemu: clarify message about block peek format restriction

Include the actual disk format in the error message to help the user see
what is wrong.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: include kernel version in QEMU log file
Daniel P. Berrangé [Fri, 18 May 2018 11:17:38 +0000 (12:17 +0100)]
qemu: include kernel version in QEMU log file

We currently print the libvirt and qemu version strings into the
per-guest logfile. It would be useful to know what kernel is running
too, so add that.

Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agospec: Fix build without QEMU
Jiri Denemark [Fri, 18 May 2018 15:15:16 +0000 (17:15 +0200)]
spec: Fix build without QEMU

libvirt_qemu_probes.stp is only generated when QEMU driver is enabled.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoRemove type_sep parameter from qemuBuildHostNetStr
Ján Tomko [Fri, 18 May 2018 13:41:25 +0000 (15:41 +0200)]
Remove type_sep parameter from qemuBuildHostNetStr

The last caller not passing a comma was removed by:
commit ad8a7c4f8599bd58608500a72cdfec18a6bf2318
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2018-04-12 17:17:16 +0200

    qemu: deprecate QEMU_CAPS_NETDEV

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: command: Remove qemuBuildHasMasterKey
Peter Krempa [Thu, 17 May 2018 08:43:26 +0000 (10:43 +0200)]
qemu: command: Remove qemuBuildHasMasterKey

The thin wrapper is not necessary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Fix formatting of TLS backend properties
Peter Krempa [Wed, 16 May 2018 15:55:39 +0000 (17:55 +0200)]
qemu: command: Fix formatting of TLS backend properties

The JSON property generator should not escape commas as we do on the
command line. The JSON->commandline generator already does that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2argv: Test TLS certificate path containing a comma
Peter Krempa [Thu, 17 May 2018 08:16:48 +0000 (10:16 +0200)]
tests: qemuxml2argv: Test TLS certificate path containing a comma

We have to escape commas when formatting them on the command line. Add a
test case of a TLS path containing a comma.

Note that the output is wrong, this test case is to prove there's a bug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Optimize formatting of 'passwordid' in qemuBuildTLSx509BackendProps
Peter Krempa [Thu, 17 May 2018 08:09:10 +0000 (10:09 +0200)]
qemu: command: Optimize formatting of 'passwordid' in qemuBuildTLSx509BackendProps

Use the 'S' modifier for create the field optionally rather than calling
another JSON formatter function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Implement multiple screen support for virDomainScreenshot
Michal Privoznik [Thu, 17 May 2018 11:53:34 +0000 (13:53 +0200)]
qemu: Implement multiple screen support for virDomainScreenshot

According to virDomainScreenshot() documentation, screens are
numbered sequentially.  e.g. having two graphics cards, both with
four heads, screen ID 5 addresses the second head on the second
card.

But apart from that, there's nothing special happening here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Introduce QEMU_CAPS_SCREENDUMP_DEVICE
Michal Privoznik [Thu, 17 May 2018 09:41:37 +0000 (11:41 +0200)]
qemu: Introduce QEMU_CAPS_SCREENDUMP_DEVICE

As of v2.12.0-rc0~32^2 QEMU is capable specifying which display
device and head should the screendump be taken from. Track this
capability so that we can use it later in our virDomainScreenshot
API.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Add target name completion for block device options
Lin Ma [Tue, 15 May 2018 11:18:24 +0000 (19:18 +0800)]
virsh: Add target name completion for block device options

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh: Introduce virshDomainDiskTargetCompleter
Lin Ma [Tue, 15 May 2018 11:18:23 +0000 (19:18 +0800)]
virsh: Introduce virshDomainDiskTargetCompleter

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh-network: Add network name completion to 'net-uuid' command
Lin Ma [Tue, 15 May 2018 11:18:22 +0000 (19:18 +0800)]
virsh-network: Add network name completion to 'net-uuid' command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh-network: Add macro VIRSH_COMMON_OPT_NETWORK_FULL
Lin Ma [Tue, 15 May 2018 11:18:21 +0000 (19:18 +0800)]
virsh-network: Add macro VIRSH_COMMON_OPT_NETWORK_FULL

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh-network: Add network name completion to 'net-event' command
Lin Ma [Tue, 15 May 2018 11:18:20 +0000 (19:18 +0800)]
virsh-network: Add network name completion to 'net-event' command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh-network: Create macros for VSH_OT_STRING "network" option
Lin Ma [Tue, 15 May 2018 11:10:35 +0000 (19:10 +0800)]
virsh-network: Create macros for VSH_OT_STRING "network" option

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh: Only return active domain names for block* command
Lin Ma [Tue, 15 May 2018 11:10:34 +0000 (19:10 +0800)]
virsh: Only return active domain names for block* command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh: Only return active domain names for 'reset' command
Lin Ma [Tue, 15 May 2018 11:10:33 +0000 (19:10 +0800)]
virsh: Only return active domain names for 'reset' command

Signed-off-by: Lin Ma <lma@suse.com>
6 years agovirsh: Remove 'id' text from help message for 'domrename' command
Lin Ma [Tue, 15 May 2018 11:10:32 +0000 (19:10 +0800)]
virsh: Remove 'id' text from help message for 'domrename' command

The inactive domains don't have any ID identifier, So adjust the help
message.

Signed-off-by: Lin Ma <lma@suse.com>
6 years agodocs: Fix copy-paste error in formatdomaincaps
Martin Kletzander [Thu, 17 May 2018 12:54:15 +0000 (14:54 +0200)]
docs: Fix copy-paste error in formatdomaincaps

Reported-instead-of-fixing-immediately-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: erase synchronous block job cancel mentions in comments
Nikolay Shirokovskiy [Mon, 16 Apr 2018 10:56:14 +0000 (13:56 +0300)]
qemu: erase synchronous block job cancel mentions in comments

Commit [1] dropped support for synchronous block job cancel.
This patch erases remnants from comments.

[1] commit 2350d101 "qemu: Remove support for legacy block jobs"

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotests: Update caps for QEMU 2.12.0 on s390x
Shalini Chellathurai Saroja [Tue, 15 May 2018 11:46:44 +0000 (13:46 +0200)]
tests: Update caps for QEMU 2.12.0 on s390x

Let us update the existing xml and replies files for QEMU 2.12.0 on
s390x.

Used a z14 using a QEMU 2.12 GA build and the following sequence:

  tests/qemucapsprobe /usr/bin/qemu-system-s390x > \
         tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies

  VIR_TEST_REGENERATE_OUTPUT=1 tests/qemucapabilitiestest
  VIR_TEST_REGENERATE_OUTPUT=1 tests/domaincapstest

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agolog: actually do substring matches with fnmatch
Daniel P. Berrangé [Mon, 14 May 2018 13:51:14 +0000 (14:51 +0100)]
log: actually do substring matches with fnmatch

Historically we matched log filters with strstr(), and when switching to
fnmatch in cbb0fd3cfdc287f6f4653ef1f04a7cfb2ea51b27, it was stated that
we would continue to match substrings, with "foo" being equivalent to
"*foo*". Unfortuntely I forget to provide the code to actually make that
happen. This fixes it to prepend and append "*". We don't bother to
check if the pattern already has a leading/trailing '*', because
"**foo**" will match the same as "*foo*".

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRemove check for gnutls/crypto.h
Ján Tomko [Tue, 15 May 2018 10:48:33 +0000 (12:48 +0200)]
Remove check for gnutls/crypto.h

Assume its presence for gnutls >= 3.2.

Check introduced by <commit 7d21d6b>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoFix indentation in virCryptoHaveCipher
Ján Tomko [Tue, 15 May 2018 11:08:15 +0000 (13:08 +0200)]
Fix indentation in virCryptoHaveCipher

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRemove explicit check for gnutls_cipher_encrypt
Ján Tomko [Tue, 15 May 2018 10:45:12 +0000 (12:45 +0200)]
Remove explicit check for gnutls_cipher_encrypt

Introduced in gnutls 2.10, and we assume >= 3.2.

Commit 1ce9c08a added this check.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRemove explicit check for gnutls_rnd
Ján Tomko [Tue, 15 May 2018 10:42:20 +0000 (12:42 +0200)]
Remove explicit check for gnutls_rnd

Introduced in gnutls 2.12, but we require gnutls >= 3.2
Check added by commit <2d23d14>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoDeprecate GNUTLS_GCRYPT
Ján Tomko [Tue, 15 May 2018 10:30:11 +0000 (12:30 +0200)]
Deprecate GNUTLS_GCRYPT

Now that we assume GnuTLS >= 3.0, we can ditch gcrypt support.
Introduced by <commit 6094b1f>.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRequire GnuTLS >= 3.2.0
Ján Tomko [Tue, 15 May 2018 10:26:42 +0000 (12:26 +0200)]
Require GnuTLS >= 3.2.0

Ubuntu 14.04 which is not targetted as a supported platform [0]
already has 3.2.11

[0] https://libvirt.org/platforms.html

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoSkip vircryptotest and virfilecachetest without gnutls
Ján Tomko [Tue, 15 May 2018 11:01:58 +0000 (13:01 +0200)]
Skip vircryptotest and virfilecachetest without gnutls

Fix make check without gnutls.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirCryptoHashBuf: return the length of the hash in bytes
Ján Tomko [Tue, 15 May 2018 07:58:50 +0000 (09:58 +0200)]
virCryptoHashBuf: return the length of the hash in bytes

virCryptoHashString also needs to know the size of the returned hash.
Return it if the hash conversion succeeded so the caller does not need
to access the hashinfo array.

This should make virCryptoHashString build without gnutls.
Also fixes the missing return value for the virCryptoHashBuf stub.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Suggested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
6 years agovirDomainMemoryDefParseXML: Don't leak discard
Michal Privoznik [Tue, 15 May 2018 11:49:06 +0000 (13:49 +0200)]
virDomainMemoryDefParseXML: Don't leak discard

==1589== 7 bytes in 2 blocks are definitely lost in loss record 34 of 261
==1589==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==1589==    by 0x8A82794: xmlStrndup (in /usr/lib64/libxml2.so.2.9.8)
==1589==    by 0x5DD8392: virXMLPropString (virxml.c:510)
==1589==    by 0x5E12427: virDomainMemoryDefParseXML (domain_conf.c:15704)
==1589==    by 0x5E207DE: virDomainDefParseXML (domain_conf.c:20351)
==1589==    by 0x5E2184F: virDomainDefParseNode (domain_conf.c:20636)
==1589==    by 0x5E216A1: virDomainDefParse (domain_conf.c:20580)
==1589==    by 0x5E21747: virDomainDefParseFile (domain_conf.c:20606)
==1589==    by 0x112F5F: testCompareXMLToArgv (qemuxml2argvtest.c:493)
==1589==    by 0x138780: virTestRun (testutils.c:180)
==1589==    by 0x117129: mymain (qemuxml2argvtest.c:937)
==1589==    by 0x13A83C: virTestMain (testutils.c:1120)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
6 years agoqemu: hotplug: Replace qemuDomainDiskNeedRemovePR
Peter Krempa [Mon, 14 May 2018 07:30:01 +0000 (09:30 +0200)]
qemu: hotplug: Replace qemuDomainDiskNeedRemovePR

The function can be replaced by much simpler logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoutil: storage: Store PR manager alias in the definition
Peter Krempa [Fri, 11 May 2018 14:39:21 +0000 (16:39 +0200)]
util: storage: Store PR manager alias in the definition

Rather than always re-generating the alias store it in the definition
and in the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoconf: domain: Add helper to check whether a domain def requires use of PR
Peter Krempa [Mon, 14 May 2018 05:53:09 +0000 (07:53 +0200)]
conf: domain: Add helper to check whether a domain def requires use of PR

Extract the lookup code so that it can be reused later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: command: Move check whether PR manager object props need to be built
Peter Krempa [Fri, 11 May 2018 14:47:49 +0000 (16:47 +0200)]
qemu: command: Move check whether PR manager object props need to be built

Move it out of the format function and let the caller decide this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: process: Change semantics of functions starting PR daemon
Peter Krempa [Fri, 11 May 2018 13:40:34 +0000 (15:40 +0200)]
qemu: process: Change semantics of functions starting PR daemon

Libvirt only manages one PR daemon. This means that we don't need to
pass the 'disk' object and also rename the functions dealing with this
so that it's obvious we only deal with the managed PR daemon.

Signed-off-by: Peter Krempa <pkrempa@redhat st.com>
6 years agoqemu: Assign managed PR path when preparing storage source
Peter Krempa [Mon, 14 May 2018 05:28:05 +0000 (07:28 +0200)]
qemu: Assign managed PR path when preparing storage source

Rather than always checking which path to use pre-assign it when
preparing storage source.

This reduces the need to pass 'vm' around too much. For later use the
path can be retrieved from the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoutil: storage: Allow passing <source> also for managed PR case
Peter Krempa [Mon, 14 May 2018 05:25:43 +0000 (07:25 +0200)]
util: storage: Allow passing <source> also for managed PR case

To allow storing status information in the XML move the validation that
the 'path' is not valid for managed PR daemon case into
qemuDomainValidateStorageSource and allow parsing of the data even in
case when managed='yes'.

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