]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoqemu: migration: Rename qemuMigrationBakeCookie to qemuMigrationCookieFormat
Peter Krempa [Mon, 28 Sep 2020 14:49:28 +0000 (16:49 +0200)] 
qemu: migration: Rename qemuMigrationBakeCookie to qemuMigrationCookieFormat

Use a more descriptive name and move the verb to the end so that the
functions conform with the naming policy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemuxml2argv: Fix and enable 'disk-transient' case
Peter Krempa [Thu, 24 Sep 2020 10:23:24 +0000 (12:23 +0200)] 
tests: qemuxml2argv: Fix and enable 'disk-transient' case

We didn't actually use this file. Change the disk type to 'file' so that
it works in qemu and add pre and post-blockdev invocations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: validate: Allow <transient/> disks
Masayoshi Mizuma [Thu, 17 Sep 2020 13:30:43 +0000 (09:30 -0400)] 
qemu: validate: Allow <transient/> disks

Extract the validation of transient disk option. We support transient
disks in qemu under the following conditions:

 - -blockdev is used
 - the disk source is a local file
 - the disk type is 'disk'
 - the disk is not readonly

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: process: Handle transient disks on VM startup
Masayoshi Mizuma [Thu, 17 Sep 2020 13:30:45 +0000 (09:30 -0400)] 
qemu: process: Handle transient disks on VM startup

Add overlays after the VM starts before we start executing guest code.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: hotplug: Remove overlay of <transient> disk on disk unplug
Peter Krempa [Tue, 22 Sep 2020 12:53:57 +0000 (14:53 +0200)] 
qemu: hotplug: Remove overlay of <transient> disk on disk unplug

Remove the overlay if the disk was <transient/>. Note that even if we'd
forbid unplug of such a disk through the API, the disk can still be
ejected from the guest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Block migration when transient disk option is enabled
Masayoshi Mizuma [Thu, 17 Sep 2020 13:30:42 +0000 (09:30 -0400)] 
qemu: Block migration when transient disk option is enabled

Block migration when transient disk option is enabled to simplify the
handling of the overlay files.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Block disk hotplug when transient disk option is enabled
Masayoshi Mizuma [Thu, 17 Sep 2020 13:30:41 +0000 (09:30 -0400)] 
qemu: Block disk hotplug when transient disk option is enabled

For now we disable disk hotplug of transient disk as it requires
creating an overlay prior to adding the frontend.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Block blockjobs when transient disk option is enabled
Masayoshi Mizuma [Thu, 17 Sep 2020 13:30:40 +0000 (09:30 -0400)] 
qemu: Block blockjobs when transient disk option is enabled

For now we disallow blockjobs with transient disks to avoid dealing with
obsoleted overlays.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: snapshot: Introduce helpers for creating overlays on <transient/> disks
Peter Krempa [Mon, 21 Sep 2020 17:39:02 +0000 (19:39 +0200)] 
qemu: snapshot: Introduce helpers for creating overlays on <transient/> disks

To implement <transient/> disks we'll need to install an overlay on top
of the original disk image which will be discarded after the VM is
turned off. This was initially implemented by qemu but libvirt never
picked up this option as the overlays were created by qemu without
libvirt involvment which didn't work with SELinux.

With blockdev the qemu feature became unsupported so we need to do this
via the snapshot code anyways.

The helpers introduced in this patch prepare a fake snapshot disk
definition for a disk which is configured as <transient/> and use it to
create a snapshot (without actually modifying metadata or persistent
def).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: prepare cleanup for <transient/> disk overlays
Peter Krempa [Tue, 22 Sep 2020 12:39:27 +0000 (14:39 +0200)] 
qemu: prepare cleanup for <transient/> disk overlays

Later patches will implement support for <transient/> disks in libvirt
by installing an overlay on top of the configured image. This will
require cleanup after the VM will be stopped so that the state is
correctly discarded.

Since the overlay will be installed only during the startup phase of the
VM we need to ensure that qemuProcessStop doesn't delete the original
file on some previous failure. This is solved by adding
'inhibitDiskTransientDelete' VM private data member which is set prior
to any startup step and will be cleared once transient disk overlays are
established.

Based on that we can then delete the overlays for any <transient/> disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotDiskDefFree: Export and register as autoptr func
Peter Krempa [Mon, 21 Sep 2020 14:49:26 +0000 (16:49 +0200)] 
virDomainSnapshotDiskDefFree: Export and register as autoptr func

Allow using the function for creating temporary snapshot disk
definitions for creating <transient/> disk overlays.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoPost-release version bump to 6.9.0
Jiri Denemark [Thu, 1 Oct 2020 07:52:49 +0000 (09:52 +0200)] 
Post-release version bump to 6.9.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-6.8.0 v6.8.0
Jiri Denemark [Thu, 1 Oct 2020 07:50:10 +0000 (09:50 +0200)] 
Release of libvirt-6.8.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemu: agent: set ifname to NULL after freeing
Ján Tomko [Fri, 18 Sep 2020 15:56:37 +0000 (17:56 +0200)] 
qemu: agent: set ifname to NULL after freeing

CVE-2020-25637

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Fixes: 0977b8aa071de550e1a013d35e2c72615e65d520
Reviewed-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agorpc: require write acl for guest agent in virDomainInterfaceAddresses
Ján Tomko [Fri, 18 Sep 2020 15:54:14 +0000 (17:54 +0200)] 
rpc: require write acl for guest agent in virDomainInterfaceAddresses

CVE-2020-25637

Add a requirement for domain:write if source is set to
VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agorpc: add support for filtering @acls by uint params
Ján Tomko [Fri, 18 Sep 2020 14:09:25 +0000 (16:09 +0200)] 
rpc: add support for filtering @acls by uint params

CVE-2020-25637

Add a new field to @acl annotations for filtering by
unsigned int parameters.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agorpc: gendispatch: handle empty flags
Ján Tomko [Fri, 18 Sep 2020 15:44:56 +0000 (17:44 +0200)] 
rpc: gendispatch: handle empty flags

CVE-2020-25637

Prepare for omission of the <flagname> in remote_protocol.x
@acl annotations:
 @acl: <object>:<permission>:<flagname>
so that we can add more fields after, e.g.:
 @acl: <object>:<permission>::<field>

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agodocs: bhyve: document sound device and VNC bits
Roman Bogorodskiy [Thu, 24 Sep 2020 16:15:34 +0000 (20:15 +0400)] 
docs: bhyve: document sound device and VNC bits

 * Document sound device support,
 * Document VNC password configuration and framebuffer resolution.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoTranslated using Weblate (Russian)
Olesya Gerasimenko [Tue, 29 Sep 2020 12:11:26 +0000 (14:11 +0200)] 
Translated using Weblate (Russian)

Currently translated at 100.0% (10354 of 10354 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ru/

Co-authored-by: Olesya Gerasimenko <gammaray@basealt.ru>
Signed-off-by: Olesya Gerasimenko <gammaray@basealt.ru>
4 years agoNEWS: Mention qcow2 cluster size being preserved across snapshots and iSCSI hostdev... v6.8.0-rc2
Peter Krempa [Thu, 24 Sep 2020 13:02:51 +0000 (15:02 +0200)] 
NEWS: Mention qcow2 cluster size being preserved across snapshots and iSCSI hostdev fixes

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sun, 27 Sep 2020 10:28:40 +0000 (12:28 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2450 of 10354 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Michał Smyk [Sun, 27 Sep 2020 10:28:37 +0000 (12:28 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2450 of 10354 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Co-authored-by: Michał Smyk <fedora@smyk.it>
Signed-off-by: Michał Smyk <fedora@smyk.it>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Sun, 27 Sep 2020 10:28:34 +0000 (12:28 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10354 of 10354 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/uk/

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agoUpdate translation files
Weblate [Sun, 27 Sep 2020 10:28:29 +0000 (12:28 +0200)] 
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agomeson: drop HTML4 variants of rst2html
Daniel P. Berrangé [Fri, 25 Sep 2020 09:37:30 +0000 (10:37 +0100)] 
meson: drop HTML4 variants of rst2html

We stopped supporting Ubuntu 16.04 earlier in the year in:

  commit 57e9f3a7e02988432c8c6790cb058b2b5372821b
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon May 4 13:06:56 2020 +0100

    gitlab: update list of distros to use latest versions

So there is no reason to keep the HTML4 variants of rst2html around.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agogitdm: add more individual contributors
Pino Toscano [Fri, 25 Sep 2020 10:39:41 +0000 (12:39 +0200)] 
gitdm: add more individual contributors

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: don't check for libutil.h except on FreeBSD
Daniel P. Berrangé [Fri, 25 Sep 2020 09:19:03 +0000 (10:19 +0100)] 
meson: don't check for libutil.h except on FreeBSD

The libutil.h we are after is explicitly only something we want on
FreeBSD, we don't want to accidentally pick up this header on other
platforms as it can lead to build failures.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolibxl: Don't free def member of virDomainObj
Jim Fehlig [Thu, 24 Sep 2020 16:39:13 +0000 (10:39 -0600)] 
libxl: Don't free def member of virDomainObj

The refactoring in commit de49d5bad3 accidentally dropped the statement
setting def to NULL after successfully adding it to the virDomainObjList,
causing it to be freed while still in use. The resulting memory
corruption caused unpredictable behavior, often resulting in a libvirtd
crash.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agonews: document recent esx API implementations
Pino Toscano [Thu, 24 Sep 2020 15:22:58 +0000 (17:22 +0200)] 
news: document recent esx API implementations

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agonews: add note about new virt-ssh-helper binary
Daniel P. Berrangé [Thu, 24 Sep 2020 15:00:23 +0000 (16:00 +0100)] 
news: add note about new virt-ssh-helper binary

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoapparmor: Allow /usr/libexec for libxl-save-helper and pygrub
Jim Fehlig [Tue, 22 Sep 2020 22:34:22 +0000 (16:34 -0600)] 
apparmor: Allow /usr/libexec for libxl-save-helper and pygrub

Like other distros, openSUSE Tumbleweed recently changed libexecdir from
/usr/lib to /usr/libexec. Add it as an allowed path for libxl-save-helper
and pygrub.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agopo: Refresh potfile for v6.8.0 v6.8.0-rc1
Jiri Denemark [Thu, 24 Sep 2020 13:06:42 +0000 (15:06 +0200)] 
po: Refresh potfile for v6.8.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemuxml2argvtest: Append newline to tested error messages
Peter Krempa [Thu, 24 Sep 2020 11:09:47 +0000 (13:09 +0200)] 
qemuxml2argvtest: Append newline to tested error messages

'virTestCompareToFile' automatically fixes newline if it is not present
in the input string but is present in the file. In this case we need to
append the erorr messages with a newline so that
VIR_TEST_REGENERATE_OUTPUT produces files which will pass syntax-check.

Fixes: 9ec77eef2df
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainNetFindIdx: add support for CCW addresses
Cornelia Huck [Thu, 24 Sep 2020 11:12:39 +0000 (13:12 +0200)] 
virDomainNetFindIdx: add support for CCW addresses

Allow to match with CCW addresses in addition to PCI addresses
(and MAC addresses).

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotDiskContextNew: Don't set 'ndd'
Peter Krempa [Thu, 24 Sep 2020 10:50:41 +0000 (12:50 +0200)] 
qemuSnapshotDiskContextNew: Don't set 'ndd'

'ndd' tracks the actual number of snapshot disks filled into the
structure and is incremented by the functions filling the context, thus
it must not be set when initializing the context.

Fixes: 8c2ecdf131c
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotDiskContextCleanup: Don't leak snapctxt
Peter Krempa [Thu, 24 Sep 2020 10:49:51 +0000 (12:49 +0200)] 
qemuSnapshotDiskContextCleanup: Don't leak snapctxt

The container itself needs to be freed too.

Fixes: 8c2ecdf131c
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: stop probing for IFF_VNET_HDR
Daniel P. Berrangé [Thu, 24 Sep 2020 09:27:03 +0000 (10:27 +0100)] 
util: stop probing for IFF_VNET_HDR

This flag was added by Linux with:

  commit f43798c27684ab925adde7d8acc34c78c6e50df8
  Author: Rusty Russell <rusty@rustcorp.com.au>
  Date:   Thu Jul 3 03:48:02 2008 -0700

    tun: Allow GSO using virtio_net_hdr

so we can assume all Linux distros we support have this flag available
and thus the compile time check is sufficient.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: Adjust libxlxml2domconfigtest to work with Xen < 4.10
Jim Fehlig [Thu, 24 Sep 2020 03:29:42 +0000 (21:29 -0600)] 
tests: Adjust libxlxml2domconfigtest to work with Xen < 4.10

Commit f253dc90f5 introduced a test regression in environments with
Xen < 4.10. The logic in libxl_conf.c correctly maps ACPI and APIC
from virDomainObj to libxl_domain_conf based on
LIBXL_HAVE_BUILDINFO_APIC, but the tests did not account for the
different libxl_domain_conf JSON representations.

One approach to fixing the test regression is to duplicate JSON test
data files, having one set for Xen <= 4.9 and another for Xen 4.10
and greater. To avoid duplicate data files, this patch takes the
approach of modifying the libxl_domain_conf object based on
LIBXL_HAVE_BUILDINFO_APIC, before retrieving the JSON representation.
It allows using the same test data files for all supported versions
of Xen by adjusting the intermediate form of libxl_domain_conf object
as needed.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotDiskPrepare: rename to qemuSnapshotDiskPrepareActiveExternal
Peter Krempa [Mon, 21 Sep 2020 14:37:44 +0000 (16:37 +0200)] 
qemuSnapshotDiskPrepare: rename to qemuSnapshotDiskPrepareActiveExternal

Make it obvious that the snapshot is prepared for the active external
snapshot case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotCreateActiveExternalDisks: Extract actual snapshot creation to 'qemuSnaps...
Peter Krempa [Mon, 21 Sep 2020 14:06:29 +0000 (16:06 +0200)] 
qemuSnapshotCreateActiveExternalDisks: Extract actual snapshot creation to 'qemuSnapshotDiskCreate'

Extract the code which invokes the monitor and finalizes the snapshot
into a separate function for easier reuse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: snapshot: Introduce qemuSnapshotDiskContext
Peter Krempa [Mon, 21 Sep 2020 13:52:43 +0000 (15:52 +0200)] 
qemu: snapshot: Introduce qemuSnapshotDiskContext

Add a container struct which holds all data needed to create and clean
up after a (for now external) snapshot. This will aggregate all the
'qemuSnapshotDiskDataPtr' the 'actions' of a transaction QMP command and
everything needed for cleanup at any given point.

This aggregation allows to simplify the arguments of the functions which
prepare the snapshot data and additionally will simplify the code
necessary for creating overlays on top of <transient/> disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotDiskPrepare/Cleanup: simplify passing of 'driver' and 'blockdev'
Peter Krempa [Mon, 21 Sep 2020 12:26:52 +0000 (14:26 +0200)] 
qemuSnapshotDiskPrepare/Cleanup: simplify passing of 'driver' and 'blockdev'

Both can be fetched from 'vm'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotDiskUpdateSource: Extract 'driver' and 'blockdev' from 'vm'
Peter Krempa [Mon, 21 Sep 2020 10:21:09 +0000 (12:21 +0200)] 
qemuSnapshotDiskUpdateSource: Extract 'driver' and 'blockdev' from 'vm'

Reduce the number of arguments by taking them from 'vm'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: snapshot: Rename 'qemuSnapshotCreateDiskActive' to 'qemuSnapshotCreateActiveExt...
Peter Krempa [Mon, 21 Sep 2020 12:15:15 +0000 (14:15 +0200)] 
qemu: snapshot: Rename 'qemuSnapshotCreateDiskActive' to 'qemuSnapshotCreateActiveExternalDisks'

Be more specific about the role of the function. It's creating the disk
portion of an external active snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovbox: reduce variable scope in vboxDumpStorageControllers
Ján Tomko [Wed, 23 Sep 2020 16:55:44 +0000 (18:55 +0200)] 
vbox: reduce variable scope in vboxDumpStorageControllers

Most of the variables were reinitialized on every iteration.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoReduce scope of some variables
Ján Tomko [Wed, 23 Sep 2020 17:28:31 +0000 (19:28 +0200)] 
Reduce scope of some variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agostorage: storageBackendWipeLocal: reduce variable scope
Ján Tomko [Wed, 23 Sep 2020 17:48:19 +0000 (19:48 +0200)] 
storage: storageBackendWipeLocal: reduce variable scope

Also use MIN instead of open-coding it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agostorage: createFileDir: use less ternary operators
Ján Tomko [Wed, 23 Sep 2020 16:53:29 +0000 (18:53 +0200)] 
storage: createFileDir: use less ternary operators

Introduce separate variables and if conditions
with spaces around them to make the function call
easier to read.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agostorage: createFileDir: remove useless 'err' variable
Ján Tomko [Wed, 23 Sep 2020 16:45:52 +0000 (18:45 +0200)] 
storage: createFileDir: remove useless 'err' variable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoapi: virDomainMemoryStats: use 'ret' variable
Ján Tomko [Wed, 23 Sep 2020 16:44:14 +0000 (18:44 +0200)] 
api: virDomainMemoryStats: use 'ret' variable

Instead of 'nr_stats_ret'. Also reduce its scope.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agolibxl: remove unused 'bits' from struct guest_arch
Ján Tomko [Tue, 22 Sep 2020 20:38:12 +0000 (22:38 +0200)] 
libxl: remove unused 'bits' from struct guest_arch

It was made pointless by:
commit c25c18f71bdc43a1305be4ad1a2ca91b25cf13f3
    Convert capabilities / domain_conf to use virArch

and unused by:
commit 8db1f2d228bb2f27a729a873dcdb81ce3c7c38fd
    Fix libxl driver for virArch changes

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoDo not check whether unsigned variables are negative
Ján Tomko [Tue, 22 Sep 2020 20:27:55 +0000 (22:27 +0200)] 
Do not check whether unsigned variables are negative

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agovirsh: virshStreamSourceSkip: remove unused 'off'
Ján Tomko [Wed, 23 Sep 2020 17:57:09 +0000 (19:57 +0200)] 
virsh: virshStreamSourceSkip: remove unused 'off'

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agovbox: remove VBoxCGlueTerm
Ján Tomko [Tue, 22 Sep 2020 20:38:34 +0000 (22:38 +0200)] 
vbox: remove VBoxCGlueTerm

cppcheck reports:
  src/vbox/vbox_XPCOMCGlue.c:226:21: style:
  The statement 'if (hVBoxXPCOMC!=NULL) hVBoxXPCOMC=NULL' is
  logically equivalent to 'hVBoxXPCOMC=NULL'.
  [duplicateConditionalAssign]

It does not matter anyway because this function
is never called.

Fixes: e1506cb4eb7eab96e7ded27a23f0d8ac9697ac2a
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agotools: virshCheckpointListCollect: remove unused names
Ján Tomko [Wed, 23 Sep 2020 16:17:44 +0000 (18:17 +0200)] 
tools: virshCheckpointListCollect: remove unused names

Introduced by:
commit 689beaa47c51fb49fafa992dd468116b8f6b0782
and unused since.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoxen: Don't add dom0 twice on driver reload
Jim Fehlig [Fri, 11 Sep 2020 17:35:47 +0000 (11:35 -0600)] 
xen: Don't add dom0 twice on driver reload

When the xen driver loads, it probes libxl for some info about dom0 and
adds it to the virDomainObjList. The driver then looks for any domains
in stateDir and if they are still alive adds them to the list as well.
This logic is a bit flawed wrt handling driver reload and causes the
following error

  internal error: unexpected domain Domain-0 already exists

A simple fix is to load all domains from stateDir first and then only
add dom0 if needed.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2argvtest: Test timer validation for non-x86 arches
Sebastian Mitterle [Tue, 22 Sep 2020 11:57:40 +0000 (11:57 +0000)] 
qemuxml2argvtest: Test timer validation for non-x86 arches

Add minimal coverage for non-x86_64 timer validation
from commit 2f5d8ffebe5d3d00e16a051ed62ce8a703f18e7c

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuxml2argvtest: Test expected error messages
Sebastian Mitterle [Tue, 22 Sep 2020 11:57:39 +0000 (11:57 +0000)] 
qemuxml2argvtest: Test expected error messages

When an error is expected, the error message will be checked.
This is expressed by creating an additional ".err" file containing
the expected error message.

It is added in order to make sure the expected errors
are not masked by other errors during test execution while
leveraging the existing framework.

In order to keep it simple, an input file cannot be reused
anymore to cover several expected error cases configured
in the test code. An input file can still be reused by creating
a test case specific symlink.

For consistency, the mock needs to report an error now, too,
as every failure must have an error; otherwise a test case will
fail.

Require LC_ALL=C explicitly to make sure error messages are not
localized for testing.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Suggested-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: qemuxml2argvmock: Report error in virNumaNodesetIsAvailable
Sebastian Mitterle [Wed, 23 Sep 2020 15:33:12 +0000 (17:33 +0200)] 
tests: qemuxml2argvmock: Report error in virNumaNodesetIsAvailable

The code path is invoked by one of the test cases. Upcoming testing of
error messages would fail.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainCCWAddressAssign: Drop spurious space at end of error message
Sebastian Mitterle [Wed, 23 Sep 2020 15:31:40 +0000 (17:31 +0200)] 
virDomainCCWAddressAssign: Drop spurious space at end of error message

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainSnapshotDiskDef: Remove 'idx' field
Peter Krempa [Mon, 21 Sep 2020 17:39:51 +0000 (19:39 +0200)] 
virDomainSnapshotDiskDef: Remove 'idx' field

It's no longer needed and is valid only after virDomainSnapshotAlignDisks
is called while holding the lock.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: refactor extension to all disks
Peter Krempa [Mon, 21 Sep 2020 17:36:17 +0000 (19:36 +0200)] 
virDomainSnapshotAlignDisks: refactor extension to all disks

Last step of the algorithm in virDomainSnapshotAlignDisks is to extend
the array of disks to all VM's disk and provide defaults. This was done
by extending the array, adding defaults at the end and then sorting it.
This requires the 'idx' variable and also a separate sorting function.

If we store the pointer to existing snapshot disk definitions in a hash
table and create a new array of snapshot disk definitions, we can fill
the new array directly by either copying the definition from the old
array or adding the default.

This avoids the sorting step and thus even the need to store the index
of the domain disk altogether.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirDomainSnapshotAlignDisks: clarify handing of snapshot location
Peter Krempa [Mon, 21 Sep 2020 16:59:37 +0000 (18:59 +0200)] 
virDomainSnapshotAlignDisks: clarify handing of snapshot location

Remove the use of the 'disk_snapshot' temporary variable since accessing
the disk definition now isn't that much longer to write and use explicit
value checks instead of the (non-)zero check to make it more obvious
what the code is doing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable
Peter Krempa [Mon, 21 Sep 2020 16:58:37 +0000 (18:58 +0200)] 
virDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable

The converted string is used exactly once so we can call the conversion
without storing the result in a variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Extract domain disk definition to a local variable
Peter Krempa [Mon, 21 Sep 2020 16:51:56 +0000 (18:51 +0200)] 
virDomainSnapshotAlignDisks: Extract domain disk definition to a local variable

Extract the disk def to a local variable so that it's more obvious
what's happening and it will also allow further simplification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Add 'domdef' local variable
Peter Krempa [Mon, 21 Sep 2020 16:27:37 +0000 (18:27 +0200)] 
virDomainSnapshotAlignDisks: Add 'domdef' local variable

There are multiple places accessing the domain definition. Extract it to
a local variable so that it's more clear what's happening.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Rename 'disk' -> 'snapdisk'
Peter Krempa [Mon, 21 Sep 2020 16:26:03 +0000 (18:26 +0200)] 
virDomainSnapshotAlignDisks: Rename 'disk' -> 'snapdisk'

The 'disk' variable usually refers to a definition of a disk from the
domain definition. Rename it to 'snapdisk' to be clear that we are
talking about the snapshot disk definition especially since this
function also accesses the domain disk definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Rename 'def' -> 'snapdef'
Peter Krempa [Mon, 21 Sep 2020 15:23:10 +0000 (17:23 +0200)] 
virDomainSnapshotAlignDisks: Rename 'def' -> 'snapdef'

While this function resides in the snapshot config module, the 'def'
variable is referencing the VM definition in most places. Change the
name to 'snapdef' to avoid ambiguity especially since we are also
dealing with the domain definition in this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Refactor cleanup
Peter Krempa [Mon, 21 Sep 2020 15:06:31 +0000 (17:06 +0200)] 
virDomainSnapshotAlignDisks: Refactor cleanup

Use automatic pointer for the bitmap and get rid of the 'cleanup' label
and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot
Peter Krempa [Mon, 21 Sep 2020 17:38:11 +0000 (19:38 +0200)] 
qemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot

After virDomainSnapshotAlignDisks is called the definitions of disks in
the snapshot definition and in the domain definition are in the same
order so they can be addressed using the same index.

This frees up 'idx' to be removed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainBlockRebase: Replace ternary operator with if/else
Peter Krempa [Tue, 22 Sep 2020 09:07:39 +0000 (11:07 +0200)] 
qemuDomainBlockRebase: Replace ternary operator with if/else

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageVolDefParseXML: Use g_steal_pointer
Peter Krempa [Tue, 22 Sep 2020 09:06:25 +0000 (11:06 +0200)] 
virStorageVolDefParseXML: Use g_steal_pointer

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageSourceNew: Abort on failure
Peter Krempa [Tue, 22 Sep 2020 09:04:17 +0000 (11:04 +0200)] 
virStorageSourceNew: Abort on failure

Add an abort() on the class/object allocation failures so that
virStorageSourceNew() always returns a virStorageSource and remove
checks from all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: substitute missing model name for host-passthrough
Collin Walling [Wed, 23 Sep 2020 07:26:58 +0000 (09:26 +0200)] 
qemu: substitute missing model name for host-passthrough

Before:
  $ uname -m
  s390x
  $ cat passthrough-cpu.xml
  <cpu check="none" mode="host-passthrough" />
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
  error: Failed to compare hypervisor CPU with passthrough-cpu.xml
  error: internal error: unable to execute QEMU command 'query-cpu-model-comp
  arison': Invalid parameter type for 'modelb.name', expected: string

After:
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
  CPU described in passthrough-cpu.xml is identical to the CPU provided by hy
  pervisor on the host

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoNEWS.rst: update NVDIMM changes entry
Daniel Henrique Barboza [Tue, 22 Sep 2020 12:18:29 +0000 (09:18 -0300)] 
NEWS.rst: update NVDIMM changes entry

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefPostParse()
Daniel Henrique Barboza [Tue, 22 Sep 2020 12:12:07 +0000 (09:12 -0300)] 
domain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefPostParse()

The alignment for the pSeries NVDIMM does not depend on runtime
constraints. This means that it can be done in device parse
time, instead of runtime, allowing the domain XML to reflect
what the auto-alignment would do when the domain starts.

This brings consistency between the NVDIMM size reported by the
domain XML and what the guest sees, without impacting existing
guests that are using an unaligned size - they'll work as usual,
but the domain XML will be updated with the actual size of the
NVDIMM.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf, qemu: move qemuDomainNVDimmAlignSizePseries to domain_conf.c
Daniel Henrique Barboza [Tue, 15 Sep 2020 01:02:47 +0000 (22:02 -0300)] 
conf, qemu: move qemuDomainNVDimmAlignSizePseries to domain_conf.c

We'll use the auto-alignment function during parse time, in
domain_conf.c. Let's move the function to that file, renaming
it to virDomainNVDimmAlignSizePseries(). This will also make it
clearer that, although QEMU is the only driver that currently
supports it, pSeries NVDIMM restrictions aren't tied to QEMU.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoTranslated using Weblate (Italian)
Milo Casagrande [Thu, 10 Sep 2020 13:43:35 +0000 (15:43 +0200)] 
Translated using Weblate (Italian)

Currently translated at 24.6% (2559 of 10366 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/it/

Co-authored-by: Milo Casagrande <milo@milo.name>
Signed-off-by: Milo Casagrande <milo@milo.name>
4 years agotests: build SELinux tests
Ján Tomko [Wed, 23 Sep 2020 13:12:59 +0000 (15:12 +0200)] 
tests: build SELinux tests

We set WITH_LIBATTR in meson.build, not WITH_ATTR.

Also link securityselinuxlabeltest with test_qemu_driver_lib.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 3ace72965c3b11fc763f781ae7ce3ca29dd36507
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: do not unref event thread after joining it
Ján Tomko [Wed, 23 Sep 2020 14:30:22 +0000 (16:30 +0200)] 
util: do not unref event thread after joining it

g_thread_join() eats a reference.

==295055== Invalid read of size 4
==295055==    at 0x4DA4AE4: g_thread_unref (in /usr/lib64/libglib-2.0.so.0.6400.5)
==295055==    by 0x491D5FA: vir_event_thread_finalize (vireventthread.c:47)
==295055==    by 0x4E6BCFF: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6400.5)
==295055==    by 0x22F35CF4: qemuProcessQMPFree (qemu_process.c:8525)
==295055==    by 0x22E71B58: glib_autoptr_clear_qemuProcessQMP (qemu_process.h:237)
...
==295055==    by 0x22E98A29: qemuDomainPostParseDataAlloc (qemu_domain.c:5476)
==295055==    by 0x49ABF83: virDomainDefPostParse (domain_conf.c:6023)
==295055==  Address 0x2acb1c68 is 24 bytes inside a block of size 88 free'd
==295055==    at 0x483B9F5: free (vg_replace_malloc.c:538)
==295055==    by 0x4D80A4C: g_free (in /usr/lib64/libglib-2.0.so.0.6400.5)
...
==295055==    by 0x491D5F1: vir_event_thread_finalize (vireventthread.c:46)
==295055==    by 0x4E6BCFF: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6400.5)
==295055==    by 0x22F35CF4: qemuProcessQMPFree (qemu_process.c:8525)
==295055==    by 0x22E71B58: glib_autoptr_clear_qemuProcessQMP (qemu_process.h:237)
...
==295055==  Block was alloc'd at
==295055==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==295055==    by 0x4D80958: g_malloc (in /usr/lib64/libglib-2.0.so.0.6400.5)
...
==295055==    by 0x4DA4C32: g_thread_try_new (in /usr/lib64/libglib-2.0.so.0.6400.5)
==295055==    by 0x491D3BC: virEventThreadStart (vireventthread.c:159)
==295055==    by 0x491D3BC: virEventThreadNew (vireventthread.c:185)
...

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: f4fc3db9204407874181117085756c9ced78adad
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 23:04:17 +0000 (01:04 +0200)] 
tests: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirnetdaemon: fix memory leak in virNetDaemonCallInhibit
Pavel Hrdina [Wed, 23 Sep 2020 14:31:21 +0000 (16:31 +0200)] 
virnetdaemon: fix memory leak in virNetDaemonCallInhibit

g_variant_new() returns a weak reference which can be consumed by passing
to other g_variant* functions or to g_dbus_connection_call* functions.

This make it possible to call g_variant_new() directly as argument to
the functions above. Because this might be confusing I explicitly call
g_variant_ref_sink() to make it normal reference in both
virGDBusCallMethod() and virGDBusCallMethodWithFD() so the caller is
always responsible for the data.

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil/virgdbus: fix memory leak in virGDBusIsServiceInList
Pavel Hrdina [Wed, 23 Sep 2020 13:40:37 +0000 (15:40 +0200)] 
util/virgdbus: fix memory leak in virGDBusIsServiceInList

g_variant_iter_loop() handles freeing all arguments unless we break out
of the loop, in that case we have to free them manually.

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodocs: manpages: Strip table of contents from manpages
Peter Krempa [Wed, 23 Sep 2020 13:13:57 +0000 (15:13 +0200)] 
docs: manpages: Strip table of contents from manpages

After meson conversion the man pages started to contain the table of
contents.

In autoconf we prevented this by a 'grep -v ::contents' in the command
building the manpages.

A more cultured solution is to strip out the 'contents' docutils element
directly.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: use g_new0 instead of VIR_ALLOC
Ján Tomko [Tue, 22 Sep 2020 22:42:45 +0000 (00:42 +0200)] 
tests: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 22:59:59 +0000 (00:59 +0200)] 
tests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 22:58:49 +0000 (00:58 +0200)] 
tests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoUse (un)signed printf specifiers correctly
Ján Tomko [Tue, 22 Sep 2020 20:17:03 +0000 (22:17 +0200)] 
Use (un)signed printf specifiers correctly

Various places reported by cppcheck's invalidPrintfArgType_sint
and invalidPrintfArgType_uint.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: do not return bool in virshNetworkPortUUIDCompleter
Ján Tomko [Tue, 22 Sep 2020 20:19:26 +0000 (22:19 +0200)] 
virsh: do not return bool in virshNetworkPortUUIDCompleter

portability: Returning an integer in a function with pointer
return type is not portable. [CastIntegerToAddressAtReturn]

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agorpc: socket: properly call virSetCloseExec
Ján Tomko [Tue, 22 Sep 2020 20:29:25 +0000 (22:29 +0200)] 
rpc: socket: properly call virSetCloseExec

cppcheck reports:
style: Argument 'fd<0' to function virSetCloseExec is always 0 [knownArgument]

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 4b9919af4024a6fbc3d4ee996d8a4c27dbc44285
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: firmware: check virJSONValueObjectGet return value
Ján Tomko [Tue, 22 Sep 2020 21:22:06 +0000 (23:22 +0200)] 
qemu: firmware: check virJSONValueObjectGet return value

If the mapping is not present, we should not try to
access its elements.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 8b5b80f4c5f7342eedce0747469223387ab709ef
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: event: check return value of virInitialize
Ján Tomko [Tue, 22 Sep 2020 21:17:18 +0000 (23:17 +0200)] 
util: event: check return value of virInitialize

This function can possibly fail.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 2e07a1e14635ad25c57b66c13488feff4c8d2b0c
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: esxutilstest: depend on esx_gen_headers
Ján Tomko [Wed, 23 Sep 2020 08:29:56 +0000 (10:29 +0200)] 
tests: esxutilstest: depend on esx_gen_headers

Sometimes parallel compilation randomly fails on platforms
that do not have many drivers enabled, like macOS:

In file included from ../tests/esxutilstest.c:13:
../src/esx/esx_vi_types.h:62:10: fatal error: 'esx_vi_types.generated.typedef' file not found
 #include "esx_vi_types.generated.typedef"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

List esx_gen_headers as a source to stop meson from building
it before the headers are generated.

https://gitlab.com/libvirt/libvirt/-/jobs/726039284

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoesx: separate header and source file generation
Ján Tomko [Wed, 23 Sep 2020 06:37:20 +0000 (08:37 +0200)] 
esx: separate header and source file generation

Invoke the generator twice and introduce separate
meson targets for headers and C sources.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agogdbus: fix virGDBusCallMethodWithFD stub for non-UNIX
Ján Tomko [Wed, 23 Sep 2020 11:18:49 +0000 (13:18 +0200)] 
gdbus: fix virGDBusCallMethodWithFD stub for non-UNIX

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: a961d93768f18c28979ca2841832cd7278bf95b8
4 years agovirgdbus: add DBus reply format check
Pavel Hrdina [Mon, 21 Sep 2020 13:42:00 +0000 (15:42 +0200)] 
virgdbus: add DBus reply format check

We used to check the format of reply data with libdbus so we should do
the same with GLib DBus as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirfirewalld: fix g_variant_get call
Pavel Hrdina [Mon, 21 Sep 2020 12:39:49 +0000 (14:39 +0200)] 
virfirewalld: fix g_variant_get call

We need to pass pointer to `array`.

Reported-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoRemove redundant check when storage pool is mounted
Yi Li [Wed, 23 Sep 2020 03:34:57 +0000 (11:34 +0800)] 
Remove redundant check when storage pool is mounted

virFileComparePaths just return 0 or 1 after commit 7b48bb8
so break while after virFileComparePaths return 1

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
4 years agotests: Don't advertise VIR_TEST_EXPENSIVE to users
Andrea Bolognani [Tue, 22 Sep 2020 11:41:49 +0000 (13:41 +0200)] 
tests: Don't advertise VIR_TEST_EXPENSIVE to users

Right now, the logic that takes care of deciding whether expensive
tests should be run or not is not working correctly: more
specifically, it's not possible to use something like

  $ VIR_TEST_EXPENSIVE=1 ninja test

to override the default choice, because in meson.build we always
pass an explicit value that overrides whatever is present in the
environment.

We could implement logic to make this work properly, but that
would require some refactoring of our test infrastructure and is
arguably of little value given that running

  $ meson build -Dexpensive_tests=enabled

is very fast, so let's just stop telling users about the variable
instead and call it a day.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Include value of expensive_tests in summary
Andrea Bolognani [Tue, 22 Sep 2020 13:15:49 +0000 (15:15 +0200)] 
meson: Include value of expensive_tests in summary

It's useful information to have available at a glance.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>