]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoqemuDomainDetachShmemDevice: Don't release shmem address twice
Michal Privoznik [Wed, 23 May 2018 16:19:16 +0000 (18:19 +0200)]
qemuDomainDetachShmemDevice: Don't release shmem address twice

On shmem unplug, when qemu doesn't support DEVICE_DELETED event
(or couple of other reasons) we do two things:

1) release shmem device address,
2) call qemuDomainRemoveShmemDevice() which does 1) again.

This is potentially dangerous.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuDomainRemoveChrDevice: Release device address
Michal Privoznik [Wed, 23 May 2018 16:32:26 +0000 (18:32 +0200)]
qemuDomainRemoveChrDevice: Release device address

Instead of releasing address only sometimes in
qemuDomainDetachChrDevice() let's release it whenever the device
is actually removed from the domain definition.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: Expose virDomainDetachDeviceAlias
Michal Privoznik [Mon, 21 May 2018 14:25:13 +0000 (16:25 +0200)]
virsh: Expose virDomainDetachDeviceAlias

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoremote: Implement virDomainDetachDeviceAlias
Michal Privoznik [Mon, 21 May 2018 11:24:23 +0000 (13:24 +0200)]
remote: Implement virDomainDetachDeviceAlias

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoIntroduce virDomainDetachDeviceAlias API
Michal Privoznik [Mon, 21 May 2018 11:15:21 +0000 (13:15 +0200)]
Introduce virDomainDetachDeviceAlias API

When detaching a device it can be uniquely identified by its
alias. Instead of misusing virDomainDetachDeviceFlags which has
the same signature introduce new function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoschema: Add missing block data for nodedev
John Ferlan [Sat, 19 May 2018 12:00:58 +0000 (08:00 -0400)]
schema: Add missing block data for nodedev

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

Commit id 'fe2af45b' added output for logical_block_size and
num_blocks for both removeable and fixed storage, but did not
update the nodedev capability causing virt-xml-validate to fail.
It's listed as optional only because it only prints if the
sizes are > 0. For a CDROM drive the values won't be formatted.

Update the nodedevxml2xmltest in order to output the values
for storage based on the logic from udevProcessRemoveableMedia
and udevProcessSD with respect to the logical_blocksize and
num_blocks calculations.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Fix capability grammar for pagesElem
John Ferlan [Sat, 19 May 2018 11:02:47 +0000 (07:02 -0400)]
schema: Fix capability grammar for pagesElem

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

Commit id '02129b7c0' added a single pagesElem for slightly
different purposes. One usage was an output for host page size
listing and the other for NUMA supported page sizes. For the
former, only the pages unit and size are formatted, while for
the latter the pages unit, size, and availability data is formatted.

The virt-xml-validate would fail because it expected something
extra in the host page size output. So split up pagesElem a bit
and create pagesHost and pagesNuma for the differences.

Modify some capabilityschemadata output to have the output - even
though the results may not be realistic with respect to the
original incarnation of the data.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Add microcode element to capability grammar
John Ferlan [Sat, 19 May 2018 10:47:27 +0000 (06:47 -0400)]
schema: Add microcode element to capability grammar

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

Commit id 'd2440f3b5' added printing the <microcode> for the
capabilities, but didn't update the capabilities schema.

While at it, update capabilityschemadata for caps-test2
and caps-test3 to output some value for validation.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Add vzmigr for host migrate transport capability
John Ferlan [Fri, 18 May 2018 22:25:54 +0000 (18:25 -0400)]
schema: Add vzmigr for host migrate transport capability

Commit id '0eced74f3' added vzmigr as a valid option for
virCapabilitiesAddHostMigrateTransport, but didn't update
the capabilities schema resulting in possible virt-xml-validate
failure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Add rdma for host migrate transport capability
John Ferlan [Fri, 18 May 2018 22:00:23 +0000 (18:00 -0400)]
schema: Add rdma for host migrate transport capability

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

Commit id 'b3fd95e36' added rdma as a valid option for
virCapabilitiesAddHostMigrateTransport, but didn't update
the capabilities schema resulting in possible virt-xml-validate
failure.

While at it, update the capabilityschemadata for caps-qemu-kvm

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema,tests: Use vpxmigr for host migrate transport capability
John Ferlan [Fri, 18 May 2018 21:47:08 +0000 (17:47 -0400)]
schema,tests: Use vpxmigr for host migrate transport capability

Commit id 'e4938ce2f' changed the esx_driver to use 'vpxmigr'
instead of esx for virCapabilitiesAddHostMigrateTransport, so
update the capabilities to allow virt-xml-validate to pass and
update the test to use the newer name.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Remove xenmigr from host migrate transport capability
John Ferlan [Fri, 18 May 2018 22:05:07 +0000 (18:05 -0400)]
schema: Remove xenmigr from host migrate transport capability

Commit id '1dac5fbb' removed xenmigr as a capability option
for virCapabilitiesAddHostMigrateTransport but didn't update
the schema resulting in possible failure for virt-xml-validate.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agoschema: Add physical sizing element for storagevol grammar
John Ferlan [Fri, 18 May 2018 21:25:01 +0000 (17:25 -0400)]
schema: Add physical sizing element for storagevol grammar

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

Commit id '78661cb' added a physical output, but failed to update
the schema resulting in a failure from virt-xml-validate.

While at it - update the storagevolschemadata for the output.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by Michal Privoznik <mprivozn@redhat.com>

6 years agodisk: Allow settling to occur after reading partitions
John Ferlan [Thu, 24 May 2018 15:10:57 +0000 (11:10 -0400)]
disk: Allow settling to occur after reading partitions

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

In order to avoid a possible error as a result of kernel interactions
with the partition helper, let's use virWaitForDevices to force things
to settle down before attempting to open and read the partition. This
is related to https://bugzilla.redhat.com/show_bug.cgi?id=1264719.

Although perhaps overkill to have too many places to settle, since
we know that the act of reading the partitions via libvirt_parthelper
will cause udev activity/events - we just need to ensure udev has
been settled before proceding with usage of the device.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agodocs: Add news article for VM Generation ID
John Ferlan [Wed, 11 Apr 2018 20:01:54 +0000 (16:01 -0400)]
docs: Add news article for VM Generation ID

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agodomcaps: Add 'genid' to domain capabilities
John Ferlan [Fri, 27 Apr 2018 12:16:40 +0000 (08:16 -0400)]
domcaps: Add 'genid' to domain capabilities

Report domaincaps <features><genid supported='yes'/> if the guest
config accepts <genid/> or <genid>$GUID</genid>.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Add VM Generation ID to qemu command line
John Ferlan [Tue, 20 Mar 2018 22:29:46 +0000 (18:29 -0400)]
qemu: Add VM Generation ID to qemu command line

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

If the domain requests usage of the genid functionality,
then add the QEMU '-device vmgenid' to the command line
providing either the supplied or generated GUID value.

Add tests for both a generated and supplied GUID value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
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>