]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agocpu: move the CPU map data files into a src/cpu_map directory
Daniel P. Berrangé [Thu, 16 Aug 2018 11:39:39 +0000 (12:39 +0100)]
cpu: move the CPU map data files into a src/cpu_map directory

In preparation for splitting up the CPU map data file, move it into a
dedicated directory of its own.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: simplify failure cleanup paths
Daniel P. Berrangé [Thu, 16 Aug 2018 10:59:44 +0000 (11:59 +0100)]
cpu: simplify failure cleanup paths

Get rid of the separate 'error:' label, so all code paths jump straight
to the 'cleanup:' label.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: push more parsing logic into common code
Daniel P. Berrangé [Mon, 30 Jul 2018 16:08:38 +0000 (17:08 +0100)]
cpu: push more parsing logic into common code

The x86 and ppc impls both duplicate some logic when parsing CPU
features. Change the callback signature so that this duplication can be
pushed up a level to common code.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: fix cleanup when signature parsing fails
Daniel P. Berrangé [Thu, 16 Aug 2018 10:28:54 +0000 (11:28 +0100)]
cpu: fix cleanup when signature parsing fails

Two pieces of code accidentally jumped to the wrong label when they
failed causing incorrect cleanup, returning a partially initialized
CPU model struct.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: allow include files for CPU definition
Daniel P. Berrangé [Mon, 30 Jul 2018 15:35:57 +0000 (16:35 +0100)]
cpu: allow include files for CPU definition

Allow for syntax

    <include filename="subdir/fooo.xml"/>

to reference other files in the CPU database directory

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoconf: report enum errors in virDomainInputDefValidate
Ján Tomko [Tue, 21 Aug 2018 12:53:55 +0000 (14:53 +0200)]
conf: report enum errors in virDomainInputDefValidate

Commit deb057f added a switch without a default case.
Add it and call virReportEnumRangeError for _LAST too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: initialize variables in qemuParseCommandLine
Ján Tomko [Tue, 28 Aug 2018 10:53:25 +0000 (12:53 +0200)]
qemu: initialize variables in qemuParseCommandLine

Commit 6700062 introduced a jump to error which skipped the
initialization of def:

qemu/qemu_parse_command.c:1870:9: error: variable 'def' is
used uninitialized whenever 'if' condition is true
      [-Werror,-Wsometimes-uninitialized]
    if (!(qemuCaps = virQEMUCapsCacheLookup(capsCache, progargv[0])))

Initialize def to fix this warning and qemuCaps, to prevent
a future error like this.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: fix default machine for argv -> xml convertor
Daniel P. Berrangé [Mon, 13 Aug 2018 11:42:01 +0000 (12:42 +0100)]
qemu: fix default machine for argv -> xml convertor

Historically the argv -> xml convertor wanted the same default machine
as we'd set when parsing xml. The latter has now changed, however, to
use a default defined by libvirt. The former needs fixing to again
honour the default QEMU machine.

This exposed a bug in handling for the aarch64 target, as QEMU does not
define any default machine. Thus we should not having been accepting
argv without a -machine provided.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: rename method for getting preferred machine type
Daniel P. Berrangé [Fri, 10 Aug 2018 14:06:38 +0000 (15:06 +0100)]
qemu: rename method for getting preferred machine type

The virQEMUCapsGetDefaultMachine() method doesn't get QEMU's default
machine any more, instead it gets the historical default that libvirt
prefers for each arch. Rename it, so that the old name can be used for
getting QEMU's default.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: record the QEMU default machine in capabilities
Daniel P. Berrangé [Fri, 10 Aug 2018 12:18:27 +0000 (13:18 +0100)]
qemu: record the QEMU default machine in capabilities

We don't honour the QEMU default machine type anymore, always using the
libvirt chosen default instead. The QEMU argv parser, however, will need
to know the exacty QEMU default, so we must record that info.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agotests: qemuxml2argv: Remove 'args' for tests only used in xml2xmltest
Peter Krempa [Mon, 27 Aug 2018 16:06:20 +0000 (18:06 +0200)]
tests: qemuxml2argv: Remove 'args' for tests only used in xml2xmltest

'metadata' and 'leases' are features internal to libvirt and thus don't
influence the generated QEMU command line. As they are not tested we
don't need the output files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: qemuxml2argv: Remove the 'no-shutdown' test completely
Peter Krempa [Mon, 27 Aug 2018 16:05:04 +0000 (18:05 +0200)]
tests: qemuxml2argv: Remove the 'no-shutdown' test completely

Now we assume the flag always so there's no use for this test. Probably
a leftover from the cleanup of the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: qemuxml2argv: Make use of 'vram64' QXL device tests
Peter Krempa [Mon, 27 Aug 2018 15:59:26 +0000 (17:59 +0200)]
tests: qemuxml2argv: Make use of 'vram64' QXL device tests

The test files were unused, but we don't have any other test for this
feature. Make use of the existing files by removing disks and using
DO_TEST_CAPS_LATEST to execute them. The legacy output files will be
dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agotests: qemuxml2argv: Remove 'args' files for tests expecting failure
Peter Krempa [Mon, 27 Aug 2018 15:54:50 +0000 (17:54 +0200)]
tests: qemuxml2argv: Remove 'args' files for tests expecting failure

Output file does not make sense for those.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Move some device_conf predicates
Andrea Bolognani [Fri, 17 Aug 2018 13:35:19 +0000 (15:35 +0200)]
conf: Move some device_conf predicates

Turn

  virPCIDeviceAddressIsEmpty()
  virDeviceInfoPCIAddressIsWanted()
  virDeviceInfoPCIAddressIsPresent()

from inline functions to regular functions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Rename some device_conf predicates
Andrea Bolognani [Fri, 17 Aug 2018 13:12:42 +0000 (15:12 +0200)]
conf: Rename some device_conf predicates

The affected functions are

  virDeviceInfoPCIAddressWanted()
  virDeviceInfoPCIAddressPresent()

which get renamed to

  virDeviceInfoPCIAddressIsWanted()
  virDeviceInfoPCIAddressIsPresent()

to comply with the naming convention used for other
predicates.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovsh: Fix broken build on mingw
Simon Kobyda [Mon, 27 Aug 2018 15:44:29 +0000 (17:44 +0200)]
vsh: Fix broken build on mingw

The function wcwidth() doesn't exist on mingw. However, it does exist in
gnulib, so we can rely on that.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovircgroup: Remove obsolete sa_assert
Pavel Hrdina [Sun, 19 Aug 2018 09:04:35 +0000 (11:04 +0200)]
vircgroup: Remove obsolete sa_assert

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Simplify if conditions in virCgroupMakeGroup
Pavel Hrdina [Sun, 19 Aug 2018 09:04:52 +0000 (11:04 +0200)]
vircgroup: Simplify if conditions in virCgroupMakeGroup

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Call virCgroupRemove inside virCgroupMakeGroup
Pavel Hrdina [Fri, 17 Aug 2018 13:00:44 +0000 (15:00 +0200)]
vircgroup: Call virCgroupRemove inside virCgroupMakeGroup

This fixes virCgroupEnableMissingControllers where virCgroupRemove
was not called in case virCgroupMakeGroup failed.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Split virCgroupPathOfController into two functions
Pavel Hrdina [Wed, 15 Aug 2018 15:21:47 +0000 (17:21 +0200)]
vircgroup: Split virCgroupPathOfController into two functions

The case where we need path of any controller is only for internal use
so move it out to a different function.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Extract placement validation into function
Pavel Hrdina [Fri, 24 Aug 2018 11:54:18 +0000 (13:54 +0200)]
vircgroup: Extract placement validation into function

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Extract controller detection into function
Pavel Hrdina [Wed, 15 Aug 2018 14:14:12 +0000 (16:14 +0200)]
vircgroup: Extract controller detection into function

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agovircgroup: Duplicate string before modifying
Pavel Hrdina [Wed, 15 Aug 2018 13:59:08 +0000 (15:59 +0200)]
vircgroup: Duplicate string before modifying

The 'mntDir' is part of 'struct mntent' as a result of getmntent_r
therefore we should not mangle with it.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6 years agotests: qemuxml2argv: Drop some unused args files
Peter Krempa [Mon, 27 Aug 2018 15:01:10 +0000 (17:01 +0200)]
tests: qemuxml2argv: Drop some unused args files

aarch64-acpi-nouefi and hostdev-scsi-boot are unused. Noticed when
checking whether '-nodefconfig' is still used by libvirt.

Unused since their introduction in commit deb38c4 and bab6ee6
respectively.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: qemuDomainChangeNet: validity checks should be done before XML autocompletion
Katerina Koukiou [Fri, 24 Aug 2018 10:28:41 +0000 (12:28 +0200)]
qemu: qemuDomainChangeNet: validity checks should be done before XML autocompletion

This patch ensures that changes in attributes of interfaces will emit
errors except if they are missing from the XML.
Previously we were falsely reporting successful updates, because some
changed attributes got overwritten before the validity checks.

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

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoapparmor: fix ptrace rules with kernel 4.18
Christian Ehrhardt [Fri, 24 Aug 2018 06:07:39 +0000 (08:07 +0200)]
apparmor: fix ptrace rules with kernel 4.18

Due to kernel upstream change 338d0be4 ("apparmor: fix ptrace read check")
libvirt now hits apparmor denies like:
  apparmor="DENIED" operation="ptrace" profile="/usr/sbin/libvirtd"
  pid=4409 comm="libvirtd" requested_mask="read" denied_mask="read"
  peer="libvirt-14e92a75-7668-4b97-8f92-322fc1b9c78a"

Extend the ptrace rule to also allow 'ptrace (read)' for libvirtd to work
with these newer kernels.

Fixes: https://bugs.launchpad.net/bugs/1788603
Reported-by: Thadeu Lima de Souza Cascardo <thadeu.cascardo@canonical.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
6 years agoqemu: Start domain on a node without cpu affinity
Roman Bolshakov [Thu, 23 Aug 2018 08:49:48 +0000 (11:49 +0300)]
qemu: Start domain on a node without cpu affinity

qemuProcessInitCpuAffinity prevents a VM from getting started on a
platform that uses cpu affinity wrapper stubs e.g. macOS.

The patch adds qemuProcessInitCpuAffinity stub on all platforms without
HAVE_SCHED_GETAFFINITY or HAVE_BSD_CPU_AFFINITY.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoutil: eventpoll: Survive EBADF on macOS
Roman Bolshakov [Thu, 23 Aug 2018 08:49:32 +0000 (11:49 +0300)]
util: eventpoll: Survive EBADF on macOS

Fixes:
https://www.redhat.com/archives/libvir-list/2017-January/msg00978.html

QEMU is probed through monitor fd to check capabilities during libvirtd init.
The monitor fd is closed after probing by virQEMUCapsInitQMPCommandFree
that calls virQEMUCapsInitQMPCommandAbort that calls qemuMonitorClose,
the latter one notifies the event loop via an interrupt handle in
qemuMonitorUnregister and after then closes monitor fd.

There could be a case when interrupt is sent after eventLoop is unlocked
but before virEventPollRunOnce blocks in poll, shortly before file
descriptor is closed by qemuMonitorClose. Then poll receives closed monitor
fd in fdset and returns EBADF.

EBADF is not mentioned as a valid errno on macOS poll man-page but such
behaviour can appear release-to-release, according to cpython:
https://github.com/python/cpython/blob/master/Modules/selectmodule.c#L1161

The change also fixes the issue in qemucapabilitiestest. It returns
Bad file descriptor message 25 times without the fix.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agodocs: api_extension: Don't encourage other tools than git
Peter Krempa [Thu, 23 Aug 2018 08:46:39 +0000 (10:46 +0200)]
docs: api_extension: Don't encourage other tools than git

Save us hassle in the list if anybody would read this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: api_extension: Remove example patches
Peter Krempa [Thu, 23 Aug 2018 08:23:46 +0000 (10:23 +0200)]
docs: api_extension: Remove example patches

Now that they are not linked any more remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agodocs: api_extension: Remove links to the stale example patches
Peter Krempa [Thu, 23 Aug 2018 08:21:03 +0000 (10:21 +0200)]
docs: api_extension: Remove links to the stale example patches

The patches used as an example for the api_extension manual don't hold
up to the current standards any more. Carefully remove links and
mentions of the patches from the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Always assume QEMU_CAPS_ADD_FD
Peter Krempa [Fri, 24 Aug 2018 13:38:59 +0000 (15:38 +0200)]
qemu: capabilities: Always assume QEMU_CAPS_ADD_FD

The capability was usable since qemu 1.3 so we can remove all the
detection code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotests: qemuxml2argv: modernize TPM passthrough tests
Peter Krempa [Tue, 14 Aug 2018 11:50:01 +0000 (13:50 +0200)]
tests: qemuxml2argv: modernize TPM passthrough tests

All supported qemus support FD passing so modify the tests to test the
proper code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: command: Extract opening of TPM backend FDs for mocking purposes
Peter Krempa [Tue, 14 Aug 2018 12:17:52 +0000 (14:17 +0200)]
qemu: command: Extract opening of TPM backend FDs for mocking purposes

Allow mocking of the file descriptor numbers used for the TPM
passthrough mode by extracting the relevant code into an exported
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotests: qemuxml2argvmock: Allow 'safe' file descriptors in mocked virCommandPassFD
Peter Krempa [Tue, 14 Aug 2018 13:02:56 +0000 (15:02 +0200)]
tests: qemuxml2argvmock: Allow 'safe' file descriptors in mocked virCommandPassFD

Allow FDs which are marked as safe for FD passing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: capabilities: Detect active block commit via QMP schema probing if possible
Peter Krempa [Tue, 14 Aug 2018 15:53:05 +0000 (17:53 +0200)]
qemu: capabilities: Detect active block commit via QMP schema probing if possible

For versions where we can probe that the arguments are optional we can
perform the probing by a schema query rather than sending a separate
command to do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: qapi: Allow selecting specifically optional schema entries in virQEMUQAPISchema...
Peter Krempa [Wed, 15 Aug 2018 06:51:01 +0000 (08:51 +0200)]
qemu: qapi: Allow selecting specifically optional schema entries in virQEMUQAPISchemaTraverse

Add a new modifier character '*' which will select given schema entry
only when it is optional (denoted by the presence of the 'default' key).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: qapi: Split up virQEMUQAPISchemaObjectGetType
Peter Krempa [Wed, 15 Aug 2018 06:39:19 +0000 (08:39 +0200)]
qemu: qapi: Split up virQEMUQAPISchemaObjectGetType

Split it into a function that returns the whole schema entry so that we
can do additional checks and a helper getting the type string from the
schema entry.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: qapi: Simplify value handling in virQEMUQAPISchemaTraverse
Peter Krempa [Wed, 15 Aug 2018 06:32:04 +0000 (08:32 +0200)]
qemu: qapi: Simplify value handling in virQEMUQAPISchemaTraverse

Introduce a few variables so that we can easily access the modifier
character and also don't have to do pointer arithmetic when selecting
the schema entries. This will simplify adding of new modifier
characters.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agostorage: Add --shrink to qemu-img command when shrinking vol
John Ferlan [Fri, 17 Aug 2018 19:53:29 +0000 (15:53 -0400)]
storage: Add --shrink to qemu-img command when shrinking vol

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

When shrinking the capacity of a qcow2 or luks volume using
the qemu-img program, the --shrink qualifier must be added.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonwfilter: Add extra verbiage for binding create/delete
John Ferlan [Wed, 22 Aug 2018 22:01:41 +0000 (18:01 -0400)]
nwfilter: Add extra verbiage for binding create/delete

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

Add some cautionary words related to the create and delete
NWFilter Binding use cases and possible issues that may result
to the virsh nwfilter-binding-{create|delete} descriptions
and the virNWFilterBinding{CreateXML|Delete) API descriptions.

Essentially summarizing commit 2d9318b6c without using the
shoot yourself in the foot wording.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoaccess: Fix nwfilter-binding ACL access API name generation
John Ferlan [Tue, 21 Aug 2018 19:58:29 +0000 (15:58 -0400)]
access: Fix nwfilter-binding ACL access API name generation

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

Generation of the ACL API policy is a "automated process"
based on this perl script which "worked" with the changes to
add nwfilter binding API's because they had the "nwfilter"
prefix; however, the generated output name was incorrect
based on the remote protocol algorithm which expected to
generate names such as 'nwfilter-binding.action' instead
of 'nwfilter.binding-action'.

This effectively changes src/access/org.libvirt.api.policy entries:

  org.libvirt.api.nwfilter.binding-create ==>
      org.libvirt.api.nwfilter-binding.create

  org.libvirt.api.nwfilter.binding-delete ==>
      org.libvirt.api.nwfilter-binding.delete

  org.libvirt.api.nwfilter.binding-getattr ==>
      org.libvirt.api.nwfilter-binding.getattr

  org.libvirt.api.nwfilter.binding-read ==>
      org.libvirt.api.nwfilter-binding.read

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: monitor: Separate probing for active block commit
Peter Krempa [Tue, 14 Aug 2018 13:52:01 +0000 (15:52 +0200)]
qemu: monitor: Separate probing for active block commit

Extract the code used to probe for the functionality so that it does not
litter the code used for actual work.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Rename 'device' argument for block job control APIs
Peter Krempa [Tue, 14 Aug 2018 11:11:05 +0000 (13:11 +0200)]
qemu: monitor: Rename 'device' argument for block job control APIs

Starting from qemu 2.7 the 'device' argument is in fact a name of the
job itself. Change our APIs accordingly and adjust the error message.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Use qemuMonitorJSONBlockJobError in qemuMonitorJSONDrivePivot
Peter Krempa [Tue, 14 Aug 2018 11:04:18 +0000 (13:04 +0200)]
qemu: monitor: Use qemuMonitorJSONBlockJobError in qemuMonitorJSONDrivePivot

The API deals with a block job so use the common error reporting
function for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Move qemuMonitorJSONDrivePivot together with block-job APIs
Peter Krempa [Tue, 14 Aug 2018 11:02:43 +0000 (13:02 +0200)]
qemu: monitor: Move qemuMonitorJSONDrivePivot together with block-job APIs

Move all relevant APIs dealing with existing jobs together.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Use qemuMonitorJSONCheckError in qemuMonitorJSONBlockStream
Peter Krempa [Tue, 14 Aug 2018 10:54:16 +0000 (12:54 +0200)]
qemu: monitor: Use qemuMonitorJSONCheckError in qemuMonitorJSONBlockStream

The API does not report any special job-related error so the generic
error function should be used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Remove temporary variables
Peter Krempa [Tue, 14 Aug 2018 10:51:15 +0000 (12:51 +0200)]
qemu: monitor: Remove temporary variables

Now that the job name is used in single place in the respective
functions remove the temporary strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Use qemuMonitorJSONCheckError in qemuMonitorJSONBlockJobError
Peter Krempa [Tue, 14 Aug 2018 10:47:05 +0000 (12:47 +0200)]
qemu: monitor: Use qemuMonitorJSONCheckError in qemuMonitorJSONBlockJobError

Report the generic errors using the existing function so that we don't
reimplement the same functionality multiple times.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: monitor: Remove error classes not conforming to QAPI schema
Peter Krempa [Tue, 14 Aug 2018 10:29:10 +0000 (12:29 +0200)]
qemu: monitor: Remove error classes not conforming to QAPI schema

Both were removed prior to qemu v1.2.0-rc0 when switching to the new
error format where almost all error types were converted to GenericError.

Relevant qemu commits are <de253f14912e> and <df1e608a01eb0>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agonews: Add a mention of RISC-V guest support
Lubomir Rintel [Wed, 22 Aug 2018 09:15:28 +0000 (11:15 +0200)]
news: Add a mention of RISC-V guest support

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agotests: Add RISC-V guest
Lubomir Rintel [Wed, 22 Aug 2018 09:15:27 +0000 (11:15 +0200)]
tests: Add RISC-V guest

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agotests: Add RISC-V architectures
Lubomir Rintel [Wed, 22 Aug 2018 09:15:27 +0000 (11:15 +0200)]
tests: Add RISC-V architectures

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: assign addresses to virtio devices on RISC-V
Lubomir Rintel [Wed, 22 Aug 2018 09:15:26 +0000 (11:15 +0200)]
qemu: assign addresses to virtio devices on RISC-V

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: add qemuDomainAssignVirtioMMIOAddresses()
Lubomir Rintel [Wed, 22 Aug 2018 09:15:25 +0000 (11:15 +0200)]
qemu: add qemuDomainAssignVirtioMMIOAddresses()

We're going to need to assign virtio-mmio addresses to non-ARM
guests soon, so let's create a generic wrapper that calls to
the architecture-specific implementation.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: add qemuDomainIsRISCVVirt() and qemuDomainMachineIsRISCVVirt()
Lubomir Rintel [Wed, 22 Aug 2018 09:15:24 +0000 (11:15 +0200)]
qemu: add qemuDomainIsRISCVVirt() and qemuDomainMachineIsRISCVVirt()

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: RISC-V machines have no PCI
Lubomir Rintel [Wed, 22 Aug 2018 09:15:23 +0000 (11:15 +0200)]
qemu: RISC-V machines have no PCI

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoutil: add RISC-V architectures
Lubomir Rintel [Wed, 22 Aug 2018 09:15:22 +0000 (11:15 +0200)]
util: add RISC-V architectures

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Rename qemuDomain*IsVirt() to qemuDomain*IsARMVirt()
Lubomir Rintel [Wed, 22 Aug 2018 09:15:20 +0000 (11:15 +0200)]
qemu: Rename qemuDomain*IsVirt() to qemuDomain*IsARMVirt()

They're ARM specific.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agovsh: Added tests
Simon Kobyda [Thu, 23 Aug 2018 15:53:43 +0000 (17:53 +0200)]
vsh: Added tests

For now, there are 9 test cases
- testVshTableNew: Creating table with empty header
- testVshTableHeader: Printing table with/without header
- testVshTableRowAppend: Appending row with various number of cells.
  Only row with same number of cells as in header is accepted.
- testUnicode: Printing table with unicode characters.
  Checking correct alignment.
- testUnicodeArabic: test opposite (right to left) writing
- testUnicodeZeroWidthChar
- testUnicodeCombiningChar
- testUnicodeNonPrintableChar,
- testNTables: Create and print varios types of tables - one column,
  one row table, table without content, standart table...

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
6 years agovirsh: Implement new table API for virsh list
Simon Kobyda [Thu, 23 Aug 2018 15:53:42 +0000 (17:53 +0200)]
virsh: Implement new table API for virsh list

Instead of printing it straight in virsh, it creates table struct
which is filled with header and rows(domains). It allows us to know
more about table before printing to calculate alignment right.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
6 years agovsh: Add API for printing tables.
Simon Kobyda [Thu, 23 Aug 2018 15:53:41 +0000 (17:53 +0200)]
vsh: Add API for printing tables.

It solves problems with alignment of columns. Width of each column
is calculated by its biggest cell. Should solve unicode bug.
In future, it may be implemented in virsh, virt-admin...

This API has 5 public functions:
- vshTableNew - adds new table and defines its header
- vshTableRowAppend - appends new row (for same number of columns as in
header)
- vshTablePrintToStdout
- vshTablePrintToString
- vshTableFree

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

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Make sure preferredMachines is not missing any entry
Andrea Bolognani [Thu, 23 Aug 2018 16:46:52 +0000 (18:46 +0200)]
qemu: Make sure preferredMachines is not missing any entry

With the current implementation, adding a new architecture
and not updating preferredMachines accordingly will not
cause a build failure, making it very likely that subtle
bugs will be introduced in the process. Rework the code
so that such issues will be caught by the compiler.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agostorage: fix the error message when encrypted raw volume resize
Shivaprasad G Bhat [Mon, 20 Aug 2018 06:27:13 +0000 (11:57 +0530)]
storage: fix the error message when encrypted raw volume resize

The vol-dumpxml shows the volume target format type as raw for
encrypted volumes. The error message when attempting to resize
with prealloc is confusing here.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: fix error message on directory creation
Eric Blake [Wed, 22 Aug 2018 21:21:51 +0000 (16:21 -0500)]
qemu: fix error message on directory creation

Minor copy-and-paste bug present since commit 462c74c3, in Apr 2010.

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu: monitor: Fix device matching in qemuMonitorJSONBlockIoThrottleInfo
Peter Krempa [Wed, 22 Aug 2018 11:20:52 +0000 (13:20 +0200)]
qemu: monitor: Fix device matching in qemuMonitorJSONBlockIoThrottleInfo

We should compare the alias/qdev id only when it was provided by the
caller and when it was found in the reply. Otherwise we could
dereference a NULL pointer. STRNEQ_NULLABLE is not appropriate since
it would return 'true' if the string was not present in the JSON output.

Found by Coverity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: hotplug: Don't leak 'nodename' in qemuDomainChangeMediaBlockdev
Peter Krempa [Wed, 22 Aug 2018 11:09:50 +0000 (13:09 +0200)]
qemu: hotplug: Don't leak 'nodename' in qemuDomainChangeMediaBlockdev

qemuDomainDiskGetBackendAlias allocates a copy of the nodename string so
we need to free it at the end.

Found by Coverity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: hotplug: Don't generate alias when detaching controllers
Peter Krempa [Wed, 22 Aug 2018 11:07:21 +0000 (13:07 +0200)]
qemu: hotplug: Don't generate alias when detaching controllers

qemuDomainDetachControllerDevice contained code which implied that alias
might be NULL when detaching the disk and tried to generate it. This is
no longer possible so we can remove the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosrc: storage: Provide a better explanation of virStoragePoolSetAutostart
Dan Kenigsberg [Wed, 22 Aug 2018 05:43:32 +0000 (08:43 +0300)]
src: storage: Provide a better explanation of virStoragePoolSetAutostart

The former documentation was an unhelpful tautology. The suggested doc
borrows the wording from virDomainSetAutostart.

Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoprocess: wait longer 5->30s on hard shutdown
Christian Ehrhardt [Mon, 6 Aug 2018 10:10:38 +0000 (12:10 +0200)]
process: wait longer 5->30s on hard shutdown

In cases where virProcessKillPainfully already reailizes that
SIGTERM wasn't enough we are partially on a bad path already.
Maybe the system is overloaded or having serious trouble to free and
reap resources in time.

In those case give the SIGKILL that was sent after 10 seconds some more
time to take effect if force was set (only then we are falling back to
SIGKILL anyway).

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoprocess: wait longer on kill per assigned Hostdev
Christian Ehrhardt [Thu, 2 Aug 2018 07:05:18 +0000 (09:05 +0200)]
process: wait longer on kill per assigned Hostdev

It was found that in cases with host devices virProcessKillPainfully
might be able to send signal zero to the target PID for quite a while
with the process already being gone from /proc/<PID>.

That is due to cleanup and reset of devices which might include a
secondary bus reset that on top of the actions taken has a 1s delay
to let the bus settle. Due to that guests with plenty of Host devices
could easily exceed the default timeouts.

To solve that, this adds an extra delay of 2s per hostdev that is associated
to a VM.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
6 years agoqemu: driver: Prepare qemuDomainGetStatsBlock (bulk disk stats) for -blockdev
Peter Krempa [Wed, 25 Jul 2018 07:28:41 +0000 (09:28 +0200)]
qemu: driver: Prepare qemuDomainGetStatsBlock (bulk disk stats) for -blockdev

Add code paths which call into the new functions to gather the data on a
per-node-name basis and tweak the aliases used for extracting the data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Allow using blockdev with qemuDomainBlocksStatsGather
Peter Krempa [Tue, 19 Jun 2018 13:38:11 +0000 (15:38 +0200)]
qemu: driver: Allow using blockdev with qemuDomainBlocksStatsGather

Use the 'qdev' instead of the disk alias to lookup the stats and
transfer the capacity from the appropriate node name so that the
function works with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Use QOM path with query-block when using -blockdev
Peter Krempa [Tue, 26 Jun 2018 16:15:09 +0000 (18:15 +0200)]
qemu: Use QOM path with query-block when using -blockdev

Switch to using the QOM/qdev handles in all calls to
qemuMonitorGetBlockInfo when using -blockdev. The callers also need to
make sure to use the correct handle afterwards to extract the data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Report data also for 'qdev' entry in qemuMonitorJSONGetBlockInfo
Peter Krempa [Mon, 6 Aug 2018 12:38:55 +0000 (14:38 +0200)]
qemu: monitor: Report data also for 'qdev' entry in qemuMonitorJSONGetBlockInfo

With -blockdev qemu will not report any useful "device" for the data
returned by 'query-block'. We need to start using the 'qdev' field to do
so in cases when "device" is empty or it does not match the entry name.

This patch adds data for the 'qdev' field into the returned data
structure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Export stats relevant for the storage backend
Peter Krempa [Tue, 7 Aug 2018 13:44:14 +0000 (15:44 +0200)]
qemu: Export stats relevant for the storage backend

Data relevant for the storage of a backing chain member will need to be
reported separately when switching to blockdev. Prepare a function that
extracts the appropriate data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Report frontend stats only for the frontend entry
Peter Krempa [Fri, 3 Aug 2018 12:19:46 +0000 (14:19 +0200)]
qemu: Report frontend stats only for the frontend entry

When reporting stats for the backing chain some of them make sense only
for the topmost entry as they are actually tied to the frontend device.
We unfortunately can't change that fact, but we can stop reporting all
zero stats for the backing chain members where they don't make any
sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Refactor control flow in qemuDomainGetStatsBlockExportDisk
Peter Krempa [Fri, 3 Aug 2018 12:13:43 +0000 (14:13 +0200)]
qemu: Refactor control flow in qemuDomainGetStatsBlockExportDisk

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Export stats relevant for the frontend separately
Peter Krempa [Thu, 2 Aug 2018 13:36:49 +0000 (15:36 +0200)]
qemu: Export stats relevant for the frontend separately

While we report the read and written byte stats for every single layer
of the backing chain, qemu in fact reports them only for the frontend.

Split out the relevant stats into a separate function so that we can
later fix this bug and stop reporting it for backing chain entries where
they don't make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Extract exporting of the header for block stats
Peter Krempa [Thu, 2 Aug 2018 13:18:16 +0000 (15:18 +0200)]
qemu: Extract exporting of the header for block stats

Split out the header so that the loop can be refactored later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Extract exporting of disk block statistics
Peter Krempa [Thu, 2 Aug 2018 12:48:26 +0000 (14:48 +0200)]
qemu: Extract exporting of disk block statistics

Split out the code which converts the stats gathered in
qemuDomainGetStatsBlock into typed parameters so that it will look
less ugly when extending it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Extract 'write-threshold' automatically for -blockdev
Peter Krempa [Fri, 29 Jun 2018 13:28:31 +0000 (15:28 +0200)]
qemu: monitor: Extract 'write-threshold' automatically for -blockdev

In cases when -blockdev is used we need to use 'query-named-block-nodes'
instead of 'query-block'. This means that we can extract the
write-threshold variable right away.

To keep compatibility with old VMs modify the code which was extracting
the value previously so that it updates the stats structure and a single
code path then can be used to extract the data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Don't pass 'virDomainDiskDefPtr' to qemuDomainGetStatsOneBlock
Peter Krempa [Fri, 29 Jun 2018 12:47:42 +0000 (14:47 +0200)]
qemu: driver: Don't pass 'virDomainDiskDefPtr' to qemuDomainGetStatsOneBlock

Allow reuse of qemuDomainGetStatsOneBlock to work with nodenames by
removing the code that looks up the stats data to the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Add APIs for refreshing disk capacity when using -blockdev
Peter Krempa [Thu, 28 Jun 2018 10:35:16 +0000 (12:35 +0200)]
qemu: monitor: Add APIs for refreshing disk capacity when using -blockdev

Disk image size data are not contained in the reply of query-blockstats
but need to be gathered from query-block. For use with -blockdev we
really need to call 'query-named-block-nodes' and process it to retrieve
the correct data.

This patch introduces qemuMonitorBlockStatsUpdateCapacityBlockdev which
updates the capacity data by nodename rather than device name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Retrieve blockstats also by qdev and node-names
Peter Krempa [Fri, 3 Aug 2018 14:22:19 +0000 (16:22 +0200)]
qemu: monitor: Retrieve blockstats also by qdev and node-names

For use with -blockdev we need to be able to retrieve the stats by
'qdev' for the frontend device stats since 'device' will be empty. Note
that for non-blockdev case qdev and 'device' with 'drive-' skipped would
be the same.

Additionally so that we can report the highest written offset we need to
also be able to access them by node-name for backing chain purposes.

In cases when 'device' is empty it does not make sense to gather them.

Allow arranging the stats simultaneously in all the above dimensions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Explicitly find disks for stats totals
Peter Krempa [Fri, 3 Aug 2018 13:30:13 +0000 (15:30 +0200)]
qemu: Explicitly find disks for stats totals

Rather than totalling every entry from 'query-block' for stats provided
by qemuDomainBlocksStatsGather total only stats for known disks. This
will allow to return data for nodenames and qdevs in the same hash so
that we can use them with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Don't copy disk alias in qemuDomainBlocksStatsGather
Peter Krempa [Fri, 3 Aug 2018 12:50:06 +0000 (14:50 +0200)]
qemu: driver: Don't copy disk alias in qemuDomainBlocksStatsGather

The string is not modified so it does not make sense to have a copy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Implement removable media change for -blockdev
Peter Krempa [Fri, 13 Jul 2018 16:06:09 +0000 (18:06 +0200)]
qemu: hotplug: Implement removable media change for -blockdev

Use the new APIs which allow to manipulate the tray and media separately
and also allow using a nodename to refer to a media to implement media
changing.

With the new approach we don't have to call eject twice as the media is
removed by calling qemuMonitorBlockdevMediumRemove.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Add APIs for cdrom tray handling for -blockdev
Peter Krempa [Thu, 12 Jul 2018 10:11:31 +0000 (12:11 +0200)]
qemu: monitor: Add APIs for cdrom tray handling for -blockdev

With blockdev we can use the full range of commands to manipulate the
tray and the medium separately. Implement monitor code for this.

Schema testing done in the qemumonitorjsontest allows us to verify that
we generate the commands correctly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Prepare for blockdev-add/blockdev-del with backing chains
Peter Krempa [Fri, 13 Jul 2018 12:48:59 +0000 (14:48 +0200)]
qemu: hotplug: Prepare for blockdev-add/blockdev-del with backing chains

Initialize data for the whole backing chain when plugging in or removing
disks when a machine supports -blockdev.

Similarly to startup we need to prepare the structures for the whole
backing chain and take care of the copy-on-read feature.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Handle BLOCK_IO_ERROR event properly with -blockdev
Peter Krempa [Mon, 13 Aug 2018 15:02:38 +0000 (17:02 +0200)]
qemu: monitor: Handle BLOCK_IO_ERROR event properly with -blockdev

Use the 'node-name' provided in the event if 'device' is empty to look
up the disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: monitor: Handle TRAY_MOVED event correctly with -blockdev
Peter Krempa [Mon, 13 Aug 2018 14:02:38 +0000 (16:02 +0200)]
qemu: monitor: Handle TRAY_MOVED event correctly with -blockdev

Add handling of the 'id' field in the event which corresponds to the
QDEV id of the device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: process: Add lookup via QOM id to qemuProcessFindDomainDiskByAlias
Peter Krempa [Mon, 13 Aug 2018 13:58:07 +0000 (15:58 +0200)]
qemu: process: Add lookup via QOM id to qemuProcessFindDomainDiskByAlias

Allow looking up also via QOM id and rename the function accordingly.
Also add documentation of the specifics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Prepare qemuDomainBlockResize for blockdev
Peter Krempa [Tue, 7 Aug 2018 08:20:05 +0000 (10:20 +0200)]
qemu: driver: Prepare qemuDomainBlockResize for blockdev

Use the nodename to resize the device rather than the drive alias.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Use QOM backend name for disk IO throttling APIs
Peter Krempa [Wed, 25 Jul 2018 07:36:01 +0000 (09:36 +0200)]
qemu: driver: Use QOM backend name for disk IO throttling APIs

With -blockdev the drive alias can't be used any more so we need to
switch to the QOM name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: process: Setup disk io throttling for -blockdev
Peter Krempa [Wed, 13 Jun 2018 15:21:02 +0000 (17:21 +0200)]
qemu: process: Setup disk io throttling for -blockdev

The proper way to do this would be to use the 'throttle' driver but
unfortunately it can't change the 'throttle_group' so we can't provide
feature parity. This hack uses the block_set_io_throttle command to do
so until we can properly replace it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Add helper to check if disk throttling is enabled
Peter Krempa [Tue, 10 Jul 2018 14:29:59 +0000 (16:29 +0200)]
qemu: command: Add helper to check if disk throttling is enabled

Add a helper which will use a collection of other helpers to determine
whether a disk requires throttling to be enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: format disk source commandline for -blockdev
Peter Krempa [Thu, 7 Jun 2018 11:17:24 +0000 (13:17 +0200)]
qemu: command: format disk source commandline for -blockdev

Format the backing chain onto the commandline using the 'json' syntax
with -blockdev.

The command line formatter needs only minor tweaks to add the new
entries but we now need to initialize the structures that are used for
every layer of the backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Prepare qemuDomainDiskGetBackendAlias for -blockdev
Peter Krempa [Wed, 18 Jul 2018 11:58:59 +0000 (13:58 +0200)]
qemu: domain: Prepare qemuDomainDiskGetBackendAlias for -blockdev

Pass in the node name as the backend alias when -blockdev is used. As
copy-on-read is expressed by a separate -blockdev backing chain member
we need to decide which node name to use here.

For empty cdroms when using -blockdev there is no backend at all so NULL
is returned.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>