]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agovirstorageobj: Move virStoragePoolObjIsDuplicate up
Michal Privoznik [Fri, 17 Aug 2018 10:14:41 +0000 (12:14 +0200)]
virstorageobj: Move virStoragePoolObjIsDuplicate up

This function is going to be made static in used in
virStoragePoolObjAssignDef(). Therefore move it a few lines up.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agostorage_backend_rbd: Drop ATTRIBUTE_UNUSED for arguments that are used
Michal Privoznik [Sat, 18 Aug 2018 16:53:13 +0000 (18:53 +0200)]
storage_backend_rbd: Drop ATTRIBUTE_UNUSED for arguments that are used

In two places the passed pool object argument is marked as
ATTRIBUTE_UNUSED even though it's used right away.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovirDomainNetDefCheckABIStability: Check for MTU change too
Michal Privoznik [Thu, 30 Aug 2018 12:11:36 +0000 (14:11 +0200)]
virDomainNetDefCheckABIStability: Check for MTU change too

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

Changing MTU on a running guest is not possible and trying to do
so made us face many problems. That's why we forbid it in
5f44d7e357f61f7. However, there is still one possible path where
users can sneak in change: migration XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovirDomainDefCompatibleDevice: Relax alias change check
Michal Privoznik [Wed, 29 Aug 2018 12:08:59 +0000 (14:08 +0200)]
virDomainDefCompatibleDevice: Relax alias change check

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

When introducing this check back in 4ad54a417a1 my mindset was
that if an element is missing in update XML then user is
requesting for removal of the corresponding setting. For
instance, if <bandwidth/> is not present in update XML any QoS
previously set on <interface/> is cleared out. Well this
assumption is correct but only to some extent.

Turns out, we have some users who when updating path to ISO
image construct very minimalistic disk XML and pass it to device
update API. Such XML is lacking a lot of information, and alias
is one of them. This triggers error in
virDomainDefCompatibleDevice() because we think that user is
requesting to remove the alias. Well, they are not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Don't overwrite stats in qemuDomainBlocksStatsGather
Peter Krempa [Thu, 30 Aug 2018 08:30:09 +0000 (10:30 +0200)]
qemu: Don't overwrite stats in qemuDomainBlocksStatsGather

The size/capacity stats gathered in qemuDomainBlocksStatsGather when
using -blockdev would be overwritten by assigning/copying the transfered
data statistics at the end. Fix it by moving the assignment prior to
fetching the capacity data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoPost-release version bump to 4.8.0
Peter Krempa [Tue, 4 Sep 2018 06:07:17 +0000 (08:07 +0200)]
Post-release version bump to 4.8.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoRelease of libvirt-4.7.0
Daniel Veillard [Mon, 3 Sep 2018 17:20:30 +0000 (19:20 +0200)]
Release of libvirt-4.7.0

* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agonews: Update for 4.7.0 release
Andrea Bolognani [Mon, 3 Sep 2018 11:55:22 +0000 (13:55 +0200)]
news: Update for 4.7.0 release

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
6 years agovirsh: Drop dead variables
Eric Blake [Fri, 31 Aug 2018 22:10:57 +0000 (17:10 -0500)]
virsh: Drop dead variables

The helper function virshSnapshotCreate (formerly vshSnapshotCreate)
has had dead variables since commit a00c37f2 (Sep 2011).

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agoqemu: mdev: Use vfio-pci 'display' property only with vfio-pci mdevs
Farhan Ali [Thu, 30 Aug 2018 17:07:34 +0000 (13:07 -0400)]
qemu: mdev: Use vfio-pci 'display' property only with vfio-pci mdevs

S390 is aware of both vfio-pci and vfio-ccw devices, so
on S390 the capability QEMU_CAPS_VFIO_PCI_DISPLAY will be
available. Add an extra check to make sure we only set the
display to off for vfio-pci mediated devices. Otherwise we
add display for vfio-ccw device and this breaks vfio-ccw
device qemu command line.

Fixes: d54e45b6e conf: Introduce new <hostdev> attribute 'display'
Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agostorage: Fix mention of disk pool default
Eric Blake [Wed, 29 Aug 2018 22:15:43 +0000 (17:15 -0500)]
storage: Fix mention of disk pool default

The default disk storage pool type in XML is 'dos', not 'msdos'.
But tweak wording to keep the term 'msdos' in the text for the
sake of grep searches.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Validate memory access during validate domain config
Luyao Huang [Mon, 20 Aug 2018 09:48:33 +0000 (17:48 +0800)]
qemu: Validate memory access during validate domain config

Commit 6534b3c4 tried to raise an error when there is no numa
nodes by setting access='shared' in the domain config, but added
a helper called from qemuDomainDeviceDefValidate instead of a
helper called from qemuDomainDefValidate for XML:

  <memoryBacking>
    <hugepages/>
    <access mode='shared'/>
  </memoryBacking>

Since there are no memory devices in the test XML, there would
be no validation failure, but the test added was still failing.
Investigating that it turns out that unnecessary XML elements
were causing the failure (no need for <video>, <graphics>,
<pm>, usb controller model "piix3-uhci", disk attribute for
"discard='unmap'", <serial>, <console>, <channel> and a
memballoon model). Removing all those before moving the method
caused the test to succeed.

So this patch moves the validation to the right place and
removes all the unnecessary XML pieces that were causing
a false validation failure.

https://bugzilla.redhat.com/show_bug.cgi?id=1448149#c14

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agovsh-table: Fix broken build on centos and rhel
Simon Kobyda [Wed, 29 Aug 2018 07:48:10 +0000 (09:48 +0200)]
vsh-table: Fix broken build on centos and rhel

The reason of broken build was that centos and rhel use older version of
glibc. These versions of glibc on these platforms cannot work with newer
unicodes, thus causing functions iswprint() and wcwidth() return
unexpected values causing the vshtabletest to fail. Therefore, let's
replace the new unicode characters causing issues with some older ones
to fix the test suite, as the issue would still persist during runtime.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirDomainObjListAddLocked: fix double free
Marc Hartmayer [Mon, 27 Aug 2018 13:20:13 +0000 (15:20 +0200)]
virDomainObjListAddLocked: fix double free

If @vm has flagged as "to be removed" virDomainObjListFindByNameLocked
returns NULL (although the definition actually exists). Therefore, the
possibility exits that "virHashAddEntry" will raise the error
"Duplicate key" => virDomainObjListAddObjLocked fails =>
virDomainObjEndAPI(&vm) is called and this leads to a freeing of @def
since @def is already assigned to vm->def. But actually this leads to
a double free since the common usage pattern is that the caller of
virDomainObjListAdd(Locked) is responsible for freeing @def in case of
an error.

Let's fix this by setting vm->def to NULL in case of an error.

Backtrace:

   ➤  bt
   #0  virFree (ptrptr=0x7575757575757575)
   #1  0x000003ffb5b25b3e in virDomainResourceDefFree
   #2  0x000003ffb5b37c34 in virDomainDefFree
   #3  0x000003ff9123f734 in qemuDomainDefineXMLFlags
   #4  0x000003ff9123f7f4 in qemuDomainDefineXML
   #5  0x000003ffb5cd2c84 in virDomainDefineXML
   #6  0x000000011745aa82 in remoteDispatchDomainDefineXML
   ...

Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
6 years agoqemu: Add more defaults for RISC-V virt guests
Andrea Bolognani [Tue, 28 Aug 2018 15:40:27 +0000 (17:40 +0200)]
qemu: Add more defaults for RISC-V virt guests

We would have used virtio for networking anyway, but it's
better to be explicit; for graphics, none of the existing
models work right now but virtio is the only one which
has a non-PCI variant, so it's as good a default as any

Spotted-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Introduce 16550A serial console model
Andrea Bolognani [Mon, 27 Aug 2018 08:25:17 +0000 (10:25 +0200)]
qemu: Introduce 16550A serial console model

None of the existing models is suitable for use with
RISC-V virt guests, and we don't want information about
the serial console to be missing from the XML.

The name is based on comments in qemu/hw/riscv/virt.c:

  RISC-V machine with 16550a UART and VirtIO MMIO

and in qemu/hw/char/serial.c:

  QEMU 16550A UART emulation

along with the output of dmesg in the guest:

  Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
  10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 13,
    base_baud= 230400) is a 16550A

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Don't use legacy USB for RISC-V guests
Andrea Bolognani [Fri, 24 Aug 2018 11:09:32 +0000 (13:09 +0200)]
qemu: Don't use legacy USB for RISC-V guests

The architecture is new enough that we don't need to
concern ourselves with backwards compatibility in any
capacity.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: no USB by default on RISC-V machines
Lubomir Rintel [Thu, 14 Jun 2018 20:32:27 +0000 (22:32 +0200)]
qemu: no USB by default on RISC-V machines

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agodocs: api_extension: Update paths in the examples
Peter Krempa [Thu, 23 Aug 2018 08:48:37 +0000 (10:48 +0200)]
docs: api_extension: Update paths in the examples

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemumonitorjson: Add test case for 'blockdev-mirror'
Peter Krempa [Thu, 16 Aug 2018 16:42:12 +0000 (18:42 +0200)]
tests: qemumonitorjson: Add test case for 'blockdev-mirror'

Add the generated testcase to test the generated command against the
QMP schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemumonitorjson: Change values which would be omitted
Peter Krempa [Thu, 16 Aug 2018 14:36:41 +0000 (16:36 +0200)]
tests: qemumonitorjson: Change values which would be omitted

Many of the parameters are omitted for NULL/0 situations. Change the
values for these cases so all the arguments are schema-checked.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemumonitorjson: Add test for 'block-stream' command
Peter Krempa [Wed, 15 Aug 2018 13:42:22 +0000 (15:42 +0200)]
tests: qemumonitorjson: Add test for 'block-stream' command

Test the generated command against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuargv2xmltest: Fix caps loading in VPATH build
Jiri Denemark [Tue, 28 Aug 2018 12:24:10 +0000 (14:24 +0200)]
qemuargv2xmltest: Fix caps loading in VPATH build

Broken by v4.7.0-rc1-9-g6700062fb0.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6 years agoutil: json: Allow converting a virTristate(Bool|Switch) into JSON
Peter Krempa [Thu, 16 Aug 2018 14:19:22 +0000 (16:19 +0200)]
util: json: Allow converting a virTristate(Bool|Switch) into JSON

Add a new modifier letter for virJSONValueObjectAddVArgs which will add
a boolean value with our tristate semantics. The value is omitted when
the _ABSENT value is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoxml: report the filename (if any) when parsing files
Daniel P. Berrangé [Thu, 16 Aug 2018 12:08:52 +0000 (13:08 +0100)]
xml: report the filename (if any) when parsing files

A generic "failed to parse xml document" message without telling us
which XML file failed is quite unhelpful.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: split x86 map data into separate files
Daniel P. Berrangé [Mon, 30 Jul 2018 16:17:21 +0000 (17:17 +0100)]
cpu: split x86 map data into separate files

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agocpu: split PPC64 map data into separate files
Daniel P. Berrangé [Mon, 30 Jul 2018 16:17:21 +0000 (17:17 +0100)]
cpu: split PPC64 map data into separate files

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
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>