]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agonetlink: Introduce macro NETLINK_MSG_APPEND to wrap nlmsg_append
Shi Lei [Mon, 11 Jan 2021 02:23:36 +0000 (10:23 +0800)] 
netlink: Introduce macro NETLINK_MSG_APPEND to wrap nlmsg_append

Introduce a macro NETLINK_MSG_APPEND to wrap nlmsg_append and
simplify code. Remove those labels 'buffer_too_small', since they
are now useless.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonetlink: Minor changes for macros NETLINK_MSG_[NEST_START|NEST_END|PUT]
Shi Lei [Mon, 11 Jan 2021 02:23:35 +0000 (10:23 +0800)] 
netlink: Minor changes for macros NETLINK_MSG_[NEST_START|NEST_END|PUT]

Move macros NETLINK_MSG_[NEST_START|NEST_END|PUT] from .h into .c;
within these macros, replace 'goto' with reporting error and returning;
simplify virNetlinkDumpLink and virNetlinkDelLink by using NETLINK_MSG_PUT.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonetlink: Remove invalid flags(NLM_F_CREATE and NLM_F_EXCL) for RTM_DELLINK
Shi Lei [Mon, 11 Jan 2021 02:23:34 +0000 (10:23 +0800)] 
netlink: Remove invalid flags(NLM_F_CREATE and NLM_F_EXCL) for RTM_DELLINK

NLM_F_CREATE and NLM_F_EXCL are invalid for RTM_DELLINK,
so remove them.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agogitlab-ci.yml: Add an explicit env variable to mark a job as broken
Erik Skultety [Thu, 14 Jan 2021 10:36:54 +0000 (11:36 +0100)] 
gitlab-ci.yml: Add an explicit env variable to mark a job as broken

Thanks to the 'rules' syntax, this will translate to
'allow_failure:true' and let the job fail but will not affect the rest
of the pipeline.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agogitlab-ci.yml: Convert only/except to the rules syntax
Erik Skultety [Thu, 14 Jan 2021 10:20:36 +0000 (11:20 +0100)] 
gitlab-ci.yml: Convert only/except to the rules syntax

'rules' syntax replaces the only/except syntax with which it is
mutually exclusive. In some cases the 'rules' syntax is more readable
than the 'only/except' equivalent, in some cases it is not.
The idea behind this conversion is to introduce an explicit env variable
controlling the 'allow_failure' attribute which would then be attached
to a broken build job which would in turn result in a soft failure.
Such behaviour is not possible to achieve with the older 'only/except'
syntax.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agogitlab-ci.yml: Replace template anchors with extends
Erik Skultety [Wed, 13 Jan 2021 16:45:06 +0000 (17:45 +0100)] 
gitlab-ci.yml: Replace template anchors with extends

'extends' is slightly more readable and definitely more flexible in
terms of allowing includes of templates.
The main reason for this patch though is that the next patch converts
the 'only/except' syntax to the new (preferable) 'rules' syntax.
Variable anchors are still kept intact because the use case there is
different from regular template anchors.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoPost-release version bump to 7.1.0
Jiri Denemark [Fri, 15 Jan 2021 08:52:51 +0000 (09:52 +0100)] 
Post-release version bump to 7.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-7.0.0 v7.0.0
Jiri Denemark [Fri, 15 Jan 2021 08:50:09 +0000 (09:50 +0100)] 
Release of libvirt-7.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoconf: disk: Parse and format <metadata_cache> also for <mirror>
Peter Krempa [Thu, 14 Jan 2021 12:57:52 +0000 (13:57 +0100)] 
conf: disk: Parse and format <metadata_cache> also for <mirror>

Commit 154df5840d added support for <metadata_cache> as property of a
<disk>. Since the same parser is used to parse the XML used with
virDomainBlockCopy it starts the copy job with the appropriate cache
configured, but the <mirror> doesn't show this configuration nor it's
preserved if libvirtd is restarted during the mirror.

Add parsing, formatting and tests for <metadata_cache> for a <mirror>.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemu: Fix memstat for (non-)transitional memballoon
Andrea Bolognani [Tue, 12 Jan 2021 16:17:44 +0000 (17:17 +0100)] 
qemu: Fix memstat for (non-)transitional memballoon

Depending on the memballoon model, the corresponding QOM node
will have a different type and we need to account for this
when searching for it in the QOM tree.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Mention stuff I've dealt with for 7.0.0
Michal Privoznik [Wed, 13 Jan 2021 09:22:14 +0000 (10:22 +0100)] 
NEWS: Mention stuff I've dealt with for 7.0.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoNEWS: update with pSeries initial memory fix v7.0.0-rc2
Daniel Henrique Barboza [Wed, 6 Jan 2021 15:04:58 +0000 (12:04 -0300)] 
NEWS: update with pSeries initial memory fix

Commit v6.10.0-103-g198c1eb6b4 fixed this issue.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Mon, 11 Jan 2021 13:28:07 +0000 (14:28 +0100)] 
Translated using Weblate (Finnish)

Currently translated at 10.9% (1145 of 10451 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Mon, 11 Jan 2021 13:28:06 +0000 (14:28 +0100)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10451 of 10451 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 [Mon, 11 Jan 2021 13:28:04 +0000 (14:28 +0100)] 
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 agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 11 Jan 2021 13:28:01 +0000 (14:28 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 21.3% (2233 of 10451 strings)

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

Translated using Weblate (Swedish)

Currently translated at 21.4% (2238 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 21.1% (2208 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 20.8% (2179 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Mon, 11 Jan 2021 13:28:00 +0000 (14:28 +0100)] 
Translated using Weblate (Polish)

Currently translated at 23.4% (2446 of 10440 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 agoqemuBlockJobEventProcess: Always clear 'mirrorState' when a job finishes
Peter Krempa [Mon, 11 Jan 2021 09:42:15 +0000 (10:42 +0100)] 
qemuBlockJobEventProcess: Always clear 'mirrorState' when a job finishes

When a block job is terminated we should clear the 'mirrorState' and
'mirrorJob' variables so that stale values are not present prior to a
new job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationSrcNBDStorageCopyReady: Use ready-state of mirror from qemuBlockJobData
Peter Krempa [Mon, 11 Jan 2021 09:40:43 +0000 (10:40 +0100)] 
qemuMigrationSrcNBDStorageCopyReady: Use ready-state of mirror from qemuBlockJobData

Use the per-job state to determine when the non-shared-storage mirror is
complete rather than the per-disk definition one. The qemuBlockJobData
is a newer approach and is always cleared after the blockjob is
terminated while the 'mirrorState' variable in the definition of the
disk may be left over. In such case the disk mirror would be considered
complete prematurely.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoci: refresh cirrus vars files
Daniel P. Berrangé [Mon, 11 Jan 2021 14:12:02 +0000 (14:12 +0000)] 
ci: refresh cirrus vars files

In this refresh the PIP variable is renamed to PIP3 and the
PYPI_PKGS variable disappears since we (currently) don't have
any need for it.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: rename the cirrus vars file to remove the "libvirt-" prefix
Daniel P. Berrangé [Mon, 11 Jan 2021 14:01:51 +0000 (14:01 +0000)] 
ci: rename the cirrus vars file to remove the "libvirt-" prefix

The "libvirt-" prefix was removed from hostnames in libvirt-ci.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: Mention KubeVirt in apps using Libvirt
Michal Privoznik [Mon, 11 Jan 2021 14:38:33 +0000 (15:38 +0100)] 
docs: Mention KubeVirt in apps using Libvirt

KubeVirt uses Libvirt to manage virtual machines run in
containers. Mention this in our apps page.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoopenvswitch: Check if OVS_VSCTL exists when getting interface name
Michal Privoznik [Sat, 9 Jan 2021 08:16:56 +0000 (09:16 +0100)] 
openvswitch: Check if OVS_VSCTL exists when getting interface name

So far we assumed that any vhostuser interface is plugged into an
OVS bridge and thus 'ovs-vsctl' exists. But this is not always
true. In testing scenarios it is possible to create a vhostuser
interface with this tool dpdk-testpmd (part of dpdk RPM) which
creates/connects to UNIX socket needed for vhostuser. Of course,
since there is no OVS then there is no interface name in which
case virNetDevOpenvswitchGetVhostuserIfname() should return 0.

The rest of APIs that assume OVS are not 'fixed' because we still
want them to fail (e.g. getting statistics, plugging interface
into an OVS bridge, unplugging it from an OVS bridge, ...).

The only API that is fixed is
virNetDevOpenvswitchGetVhostuserIfname() because it is called
explicitly when starting a guest (and callers are okay if no name
was found).

The other way to fix this bug seems to be to simply require
'ovs-vsctl' on spec file level, but that is too heavy gun given
that vhostuser is used by a small set of our users (assumption
made on requirements for vhostuser). Also, this way would drag in
yet another dependency for all users (even those who want minimal
libvirt).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1913156
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: kbase: sev: Adjust the claims that virtio-blk doesn't work
Erik Skultety [Fri, 8 Jan 2021 16:23:32 +0000 (17:23 +0100)] 
docs: kbase: sev: Adjust the claims that virtio-blk doesn't work

Using virtio-blk with SEV on host kernels prior to 5.1 didn't work
because of SWIOTLB limitations and the way virtio has to use it over
DMA-API for SEV (see [1] for detailed info). That is no longer true, so
reword the kbase article accordingly.

For reference, these are the upstream kernel commits lifting the
virtio-blk limitation:
abe420bfae528c92bd8cc5ecb62dc95672b1fd6f
492366f7b4237257ef50ca9c431a6a0d50225aca
133d624b1cee16906134e92d5befb843b58bcf31
e6d6dd6c875eb3c9b69bb640419405726e6e0bbe
fd1068e1860e44aaaa337b516df4518d1ce98da1

[1] https://lore.kernel.org/linux-block/20190110134433.15672-1-joro@8bytes.org/

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoNEWS: Mention stuff I've dealt with for 7.0
Peter Krempa [Mon, 11 Jan 2021 10:39:26 +0000 (11:39 +0100)] 
NEWS: Mention stuff I've dealt with for 7.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agodocs: downloads: Establish handover of package signing
Peter Krempa [Mon, 11 Jan 2021 10:08:15 +0000 (11:08 +0100)] 
docs: downloads: Establish handover of package signing

Starting from libvirt-6.6 the releases are done by Jirka. Add a formal
statement from DV handing over the signature.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: downloads: Move 'signatures' section to the end of the document
Peter Krempa [Mon, 11 Jan 2021 10:05:37 +0000 (11:05 +0100)] 
docs: downloads: Move 'signatures' section to the end of the document

Keep the more important stuff outlining how to get to the sources first
since the 'signatures' section will be extended.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agopo: Refresh potfile for v7.0.0 v7.0.0-rc1
Jiri Denemark [Sat, 9 Jan 2021 00:14:30 +0000 (01:14 +0100)] 
po: Refresh potfile for v7.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-data: Pretend to always run on logical processor #0
Tim Wiederhake [Fri, 8 Jan 2021 14:43:02 +0000 (15:43 +0100)] 
cpu-data: Pretend to always run on logical processor #0

The output of cpuid depends on the logical processor id the process
runs on, as reflected by the "local apic id" present in cpuid leaves
(eax=1,ebx=0), (eax=11,ebx=0), and (eax=11,ebx=1). This produces
arbitrary changes in the output files that complicate comparisons.

This patch masks the occurences of the local apic id with 0x00, so
that two consecutive runs of "./cpu-data.py gather" produce identical
results.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agolibxl: remove a now-unnecessary ret variable and cleanup: label.
Laine Stump [Fri, 8 Jan 2021 15:28:46 +0000 (10:28 -0500)] 
libxl: remove a now-unnecessary ret variable and cleanup: label.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agouse g_autoptr for all virConnectPtrs used with virGetConnectNetwork()
Laine Stump [Fri, 8 Jan 2021 05:31:05 +0000 (00:31 -0500)] 
use g_autoptr for all virConnectPtrs used with virGetConnectNetwork()

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agocall virDomainNetNotifyActualDevice() for all interface types
Laine Stump [Fri, 8 Jan 2021 05:36:31 +0000 (00:36 -0500)] 
call virDomainNetNotifyActualDevice() for all interface types

Now that this function can be called regardless of interface type (and
whether or not we have a conn for the network driver), let's actually
call it for all interface types. This will assure that we re-connect
any disconnected bridge devices for <interface type='bridge'> as
mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1730084#c26
(until now we've only been reconnecting bridge devices for <interface
type='network'>)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: make virDomainNetNotifyActualDevice() callable for all interface types
Laine Stump [Tue, 20 Oct 2020 16:35:09 +0000 (12:35 -0400)] 
conf: make virDomainNetNotifyActualDevice() callable for all interface types

The bridge reattach functionality in this function should be called
for interface types other than just type='network', so make it
callable for any type - it just becomes a NOP for types where no
action is needed.

In the case of <interface type='network'> we need to create a port in
the network driver, and for both type='network and type='bridge' we
need to reattach the bridge device (note that
virDomainNetGetActualBridgeName() gets the bridge name from the
appropriate (and different!) location for either type of interface).

All other interfaces currently require no action.

modifying callers of this function to actually call it for all
interface types is in the next patch. For now the behavior should be
identical pre and post-patch.

(NB: the conn argument can now legitimately be NULL, so we need to
change the ATTRIBUTE_NONNULL() directive for the function's
declaration - I noticed when making this change that argument 3 (the
NetDefPtr) could never be NULL, so I added ATTRIBUTE_NONNULL(3) while
removing ATTRIBUTE_NONNULL(1) (conn)).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>Reviewed-by: Michal Privoznik <mprivozn@redhat.com>#Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: Skip over any extra verbiage preceding version in dnsmasq version string
Laine Stump [Fri, 8 Jan 2021 01:03:05 +0000 (20:03 -0500)] 
util: Skip over any extra verbiage preceding version in dnsmasq version string

dnsmasq usually prints out a version string like this:

 Dnsmasq version 2.82 [...]

but a user reported that the build of dnsmasq included with pihole has
a version string like this:

 Dnsmasq version pi-hole-2.81 [...]

We parse the dnsmasq version number to figure out if the dnsmasq
binary supports certain features. Since we expect the version number
(and it must be only numbers!) to start on the first non-space after
the string "Dnsmasq version", we fail to parse this format of the
version string.

Rather than spending a bunch of time trying to get pihole to change
that, we can just make our parsing more permissive - after searching
for "Dnsmasq version", we'll skip ahead to the first decimal digit,
rather than just the first non-space.

(NB: The features we're checking for purely by looking at version
number have been in all releases of dnsmasq since at least 2012, so we
could actually just remove the reading of the version number
completely. However it's possible (although *highly* unlikely)
that some new feature would be added to dnsmasq in the future and we
would need to add that code back.)

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/29
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: new function virSkipToDigit()
Laine Stump [Fri, 8 Jan 2021 00:55:43 +0000 (19:55 -0500)] 
util: new function virSkipToDigit()

This function skips over the beginning of a string until it reaches a
decimal digit (0-9) or the NULL at the end of the string. The original
pointer is modified in place (similar to virSkipSpaces()).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Implement '<metadata_cache><max_size>' control for qcow2
Peter Krempa [Wed, 6 Jan 2021 17:20:29 +0000 (18:20 +0100)] 
qemu: Implement '<metadata_cache><max_size>' control for qcow2

qemu's qcow2 driver allows control of the metadata cache of qcow2 driver
by the 'cache-size' property. Wire it up to the recently introduced
elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: snapshot: Add support for <metadata_cache>
Peter Krempa [Thu, 7 Jan 2021 14:30:21 +0000 (15:30 +0100)] 
conf: snapshot: Add support for <metadata_cache>

Similarly to the domain config code it may be beneficial to control the
cache size of images introduced as snapshots into the backing chain.
Wire up handling of the 'metadata_cache' element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: Introduce <metadata_cache> subelement of <disk><driver>
Peter Krempa [Wed, 6 Jan 2021 17:20:22 +0000 (18:20 +0100)] 
conf: Introduce <metadata_cache> subelement of <disk><driver>

In certain specific cases it might be beneficial to be able to control
the metadata caching of storage image format drivers of a hypervisor.

Introduce XML machinery to set the maximum size of the metadata cache
which will be used by qemu's qcow2 driver.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotDiskDefFormat: Use virXMLFormatElement
Peter Krempa [Thu, 7 Jan 2021 14:03:57 +0000 (15:03 +0100)] 
virDomainSnapshotDiskDefFormat: Use virXMLFormatElement

Refactor the code to use modern XML formatting approach.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainDiskDefFormatDriver: Rename 'driverBuf' to 'attrBuf'
Peter Krempa [Wed, 6 Jan 2021 21:34:57 +0000 (22:34 +0100)] 
virDomainDiskDefFormatDriver: Rename 'driverBuf' to 'attrBuf'

Unify the code with other places using virXMLFormatElement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Add tests for NFS disk protocol
Ryan Gahagan [Wed, 6 Jan 2021 21:32:32 +0000 (15:32 -0600)] 
tests: Add tests for NFS disk protocol

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: virstoragefile: Add 'json:' pseudo-protocol parser for 'nfs' protocol
Ryan Gahagan [Wed, 6 Jan 2021 21:32:31 +0000 (15:32 -0600)] 
util: virstoragefile: Add 'json:' pseudo-protocol parser for 'nfs' protocol

Enable parsing of backing store strings containing the native 'nfs'
protocol specification.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: block: Add support for VIR_STORAGE_NET_PROTOCOL_NFS
Ryan Gahagan [Wed, 6 Jan 2021 21:32:30 +0000 (15:32 -0600)] 
qemu: block: Add support for VIR_STORAGE_NET_PROTOCOL_NFS

Implement support for the 'nfs' native protocol driver in the qemu
driver.

QEMU accepts numeric UID/GID for 'nfs' protocol file driver thus libvirt
needs to perform the lookup prior to passing it to qemu.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoconf: Add XML format/parse methods for VIR_STORAGE_NET_PROTOCOL_NFS
Ryan Gahagan [Wed, 6 Jan 2021 21:32:29 +0000 (15:32 -0600)] 
conf: Add XML format/parse methods for VIR_STORAGE_NET_PROTOCOL_NFS

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodocs: add rng schema and formatdomain docs for NFS
Ryan Gahagan [Wed, 6 Jan 2021 21:32:28 +0000 (15:32 -0600)] 
docs: add rng schema and formatdomain docs for NFS

Add documentation and schema for the new disk transport protocol.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: Add fields for VIR_STORAGE_NET_PROTOCOL_NFS to virStorageSource
Ryan Gahagan [Wed, 6 Jan 2021 21:32:27 +0000 (15:32 -0600)] 
util: Add fields for VIR_STORAGE_NET_PROTOCOL_NFS to virStorageSource

'nfs_user'/'nfs_group' represents the XML configuration.

'nfs_uid'/'nfs_gid' is internal store when libvirt looks up the user's
uid/gid in the system.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoconf: Add VIR_STORAGE_NET_PROTOCOL_NFS disk protocol type
Ryan Gahagan [Wed, 6 Jan 2021 21:32:26 +0000 (15:32 -0600)] 
conf: Add VIR_STORAGE_NET_PROTOCOL_NFS disk protocol type

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agostorage: volStorageBackendRBDRefreshVolInfo: refactor
Yi Li [Fri, 8 Jan 2021 06:44:31 +0000 (14:44 +0800)] 
storage: volStorageBackendRBDRefreshVolInfo: refactor

use the ret variable for return value

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agostorageBackendCreatePloop: Refactor cleanup
Yi Li [Fri, 8 Jan 2021 06:14:22 +0000 (14:14 +0800)] 
storageBackendCreatePloop: Refactor cleanup

Get rid of the 'cleanup' label and 'created' variable.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoFix MinGW pipeline after 49cb59778a4e6c2d04bb9383a9d97fbbc83f9fce
Erik Skultety [Fri, 8 Jan 2021 10:33:44 +0000 (11:33 +0100)] 
Fix MinGW pipeline after 49cb59778a4e6c2d04bb9383a9d97fbbc83f9fce

Broken build job: https://gitlab.com/libvirt/libvirt/-/jobs/951162206

Signed-off-by: Erik Skultety <eskultet@redhat.com>
4 years agocpu-gather: Rename the script as cpu-data.py
Jiri Denemark [Thu, 7 Jan 2021 17:48:41 +0000 (18:48 +0100)] 
cpu-gather: Rename the script as cpu-data.py

It is now doing way more than gathering the CPU data from a host as the
other scripts were merged in it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agocpu_map: Suggest better command for updating test data files
Jiri Denemark [Thu, 7 Jan 2021 18:48:51 +0000 (19:48 +0100)] 
cpu_map: Suggest better command for updating test data files

cpu-cpuid.py was merged into cpu-gather.py and the script can handle
multiple files so there's no need for a loop around it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agocpu-gather: Remove redundant "processor" from CPU data file names
Jiri Denemark [Thu, 7 Jan 2021 17:47:27 +0000 (18:47 +0100)] 
cpu-gather: Remove redundant "processor" from CPU data file names

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoschema: secret: Relax requirements for usage name
Peter Krempa [Wed, 6 Jan 2021 16:19:03 +0000 (17:19 +0100)] 
schema: secret: Relax requirements for usage name

There's plenty of existing documentation [1] which shows as example a
name which contains a space and a dot ('client.admin secret') as ceph
usage name.

Use a more relaxed type in the RNG schema since the usage name is
actually just a string used to look up the secret.

[1]:
https://docs.ceph.com/en/latest/rbd/libvirt/#configuring-the-vm
https://documentation.suse.com/ses/6/html/ses-all/cha-ceph-libvirt.html#ceph-libvirt-cfg-vm
Libvirt docs were correct though:
https://libvirt.org/formatsecret.html#CephUsageType

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoschema: Add define for object names
Peter Krempa [Wed, 6 Jan 2021 15:51:21 +0000 (16:51 +0100)] 
schema: Add define for object names

Objects such as domain, pool, etc re-define the regex for the format.
Add more generic types for objects with/without a slash which we'll be
able to reuse also for other objects.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoschema: Remove workaround for bug in libxml2 2.7.6
Peter Krempa [Wed, 6 Jan 2021 10:27:50 +0000 (11:27 +0100)] 
schema: Remove workaround for bug in libxml2 2.7.6

New libxml2 handles '\n' properly so the literal newline is not
necessary, because 2.9.1 is the minimum version we support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoschema: domaincommon: Remove pointless 'choice' from 'inituser'/'initgroup'
Peter Krempa [Wed, 6 Jan 2021 16:12:03 +0000 (17:12 +0100)] 
schema: domaincommon: Remove pointless 'choice' from 'inituser'/'initgroup'

'genericName' allows arbitrary numeric strings so using an explicit
'unsignedInt' choice is pointless. The elements take an username or a
uid which is prefixed by '+', both of which are covered by
'genericName'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSecretLookupParseSecret: Use g_steal_pointer
Peter Krempa [Wed, 6 Jan 2021 14:59:59 +0000 (15:59 +0100)] 
virSecretLookupParseSecret: Use g_steal_pointer

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agosecretXMLParseNode: Clean up freeing of memory
Peter Krempa [Wed, 6 Jan 2021 14:52:06 +0000 (15:52 +0100)] 
secretXMLParseNode: Clean up freeing of memory

Use one variable per extracted property instead of reusing strings and
drop needless VIR_FREE calls.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirSecretDefParseUsage: Use g_autofree for type_str
Peter Krempa [Wed, 6 Jan 2021 14:51:26 +0000 (15:51 +0100)] 
virSecretDefParseUsage: Use g_autofree for type_str

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainSetBlockIoTune: Skip monitor call for empty cdrom
Peter Krempa [Thu, 7 Jan 2021 09:19:22 +0000 (10:19 +0100)] 
qemuDomainSetBlockIoTune: Skip monitor call for empty cdrom

Similarly to startup of the VM qemu doesn't like setting throttling for
an empty drive. Just skip it since we do the correct thing once new
media is inserted.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/117
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemuDomainSetBlockIoTune: Remove old uninformative comment
Peter Krempa [Thu, 7 Jan 2021 09:15:51 +0000 (10:15 +0100)] 
qemuDomainSetBlockIoTune: Remove old uninformative comment

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotestCompareXMLToArgvValidateSchema: Populate autoNodeset
Peter Krempa [Mon, 30 Nov 2020 17:48:53 +0000 (18:48 +0100)] 
testCompareXMLToArgvValidateSchema: Populate autoNodeset

We create a new 'vm' so we must also fake the nodeset.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBuildChrChardevStr: Rename 'flags' to 'cdevflags'
Peter Krempa [Mon, 30 Nov 2020 13:14:22 +0000 (14:14 +0100)] 
qemuBuildChrChardevStr: Rename 'flags' to 'cdevflags'

The monitor code uses 'flags' for the flags of the monitor builder,
while in this function it's a different set of flags. All callers pass a
variable named 'cdevflags', so rename the argument to suit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: qemuxml2argv: Don't check whether -netdev was QAPIfied repeatedly
Peter Krempa [Mon, 30 Nov 2020 13:01:05 +0000 (14:01 +0100)] 
tests: qemuxml2argv: Don't check whether -netdev was QAPIfied repeatedly

Check once before looping through the args.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: json: Replace virJSONValueObjectSteal by virJSONValueObjectRemoveKey
Peter Krempa [Mon, 30 Nov 2020 13:59:38 +0000 (14:59 +0100)] 
util: json: Replace virJSONValueObjectSteal by virJSONValueObjectRemoveKey

virJSONValueObjectRemoveKey can be used as direct replacement. Fix the
one caller and remove the duplicate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorAddObject: Refactor cleanup
Peter Krempa [Mon, 30 Nov 2020 15:23:55 +0000 (16:23 +0100)] 
qemuMonitorAddObject: Refactor cleanup

Remove freeing/clearing of @props as the function doesn't guarantee that
it happens on success, rename the variable hodling copy of the alias and
use g_autofree to automatically free it and remove the cleanup label as
well as 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorAddObject: Fix semantics of @alias
Peter Krempa [Mon, 30 Nov 2020 15:21:18 +0000 (16:21 +0100)] 
qemuMonitorAddObject: Fix semantics of @alias

The callers of qemuMonitorAddObject rely on the fact that @alias is
filled only when the object is added successfully. This is documented
but the code didn't behave like that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorJSONMakeCommandInternal: Clear @arguments when stolen
Peter Krempa [Mon, 30 Nov 2020 14:34:56 +0000 (15:34 +0100)] 
qemuMonitorJSONMakeCommandInternal: Clear @arguments when stolen

All callers of qemuMonitorJSONMakeCommandInternal will benefit from
making @arguments a double pointer and passing it to
virJSONValueObjectCreate directly which will clear it if it steals the
value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorJSONAddObject: Take double pointer for @props
Peter Krempa [Mon, 30 Nov 2020 14:32:14 +0000 (15:32 +0100)] 
qemuMonitorJSONAddObject: Take double pointer for @props

Prepare for a refactor of qemuMonitorJSONMakeCommandInternal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotestQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities: refactor cleanup
Peter Krempa [Mon, 30 Nov 2020 14:29:49 +0000 (15:29 +0100)] 
testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities: refactor cleanup

Use automatic memory freeing to remove the 'cleanup:' label and 'ret'
variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorJSONSetMigrationCapabilities: Refactor cleanup
Peter Krempa [Mon, 30 Nov 2020 14:27:44 +0000 (15:27 +0100)] 
qemuMonitorJSONSetMigrationCapabilities: Refactor cleanup

Use automatic memory freeing and remove the 'cleanup' label and 'ret'
variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorSetMigrationCapabilities: Take double pointer for @caps
Peter Krempa [Mon, 30 Nov 2020 14:17:34 +0000 (15:17 +0100)] 
qemuMonitorSetMigrationCapabilities: Take double pointer for @caps

This allows simplification of the callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorJSONSetMigrationParams: Take double pointer for @params
Peter Krempa [Mon, 30 Nov 2020 14:17:34 +0000 (15:17 +0100)] 
qemuMonitorJSONSetMigrationParams: Take double pointer for @params

This allows simplification of the caller as well as will enable a later
refactor of qemuMonitorJSONMakeCommandInternal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohostdev: mdev: Lookup mdevs by sysfs path rather than mdev struct
Erik Skultety [Thu, 7 Jan 2021 15:53:21 +0000 (16:53 +0100)] 
hostdev: mdev: Lookup mdevs by sysfs path rather than mdev struct

The lookup didn't do anything apart from comparing the sysfs paths
anyway since that's what makes each mdev unique.
The most ridiculous usage of the old logic was in
virHostdevReAttachMediatedDevices where in order to drop an mdev
hostdev from the list of active devices we first had to create a new
mdev and use it in the lookup call. Why couldn't we have used the
hostdev directly? Because the hostdev and mdev structures are
incompatible.

The way mdevs are currently removed is via a write to a specific sysfs
attribute. If you do it while the machine which has the mdev assigned
is running, the write call may block (with a new enough kernel, with
older kernels it would return a write error!) until the device
is no longer in use which is when the QEMU process exits.

The interesting part here comes afterwards when we're cleaning up and
call virHostdevReAttachMediatedDevices. The domain doesn't exist
anymore, so the list of active hostdevs needs to be updated and the
respective hostdevs removed from the list, but remember we had to
create an mdev object in the memory in order to find it in the list
first which will fail because the write to sysfs had already removed
the mdev instance from the host system.
And so the next time you try to start the same domain you'll get:

"Requested operation is not valid: mediated device <path> is in use by
driver QEMU, domain <name>"

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/119
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agohostdev: Update mdev pointer reference after checking device type
Erik Skultety [Thu, 7 Jan 2021 15:48:40 +0000 (16:48 +0100)] 
hostdev: Update mdev pointer reference after checking device type

We set the pointer to some garbage packed structure data without
knowing whether we were actually handling the type of device we
expected to be handling. On its own, this was harmless, because we'd
never use the pointer as we'd skip the device if it were not the
expected type. However, it's better to make the logic even more
explicit - we first check the device and only when we're sure we have
the expected type we then update the pointer shortcut.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: validate pcie_cap_pos != 0 in virDeviceHasPCIExpressLink()
Laine Stump [Wed, 6 Jan 2021 20:42:47 +0000 (15:42 -0500)] 
util: validate pcie_cap_pos != 0 in virDeviceHasPCIExpressLink()

virDeviceHasPCIExpressLink() wasn't checking that pcie_cap_pos was
valid before attempting to use it, which could lead to reading the
byte at offset 0 + PCI_CAP_ID_EXP instead of [valid offset] +
PCI_CAP_ID_EXP. In particular, this could happen for "integrated" PCI
devices (those that are on the PCIe root complex). If it happened that
the byte from the wrong address had the "right" bit set, then it would
lead to us innappropriately believing that Express Link info was
available when it wasn't, and the node device driver would then log an
error like this:

  virPCIDeviceGetLinkCapSta:2754 :
  internal error: pci device 0000:00:18.0 is not a PCI-Express device

during a libvirtd restart. (this didn't ever occur until after
virPCIDeviceIsPCIExpress() was made more intelligent in commit
c00b6b1ae, which hasn't yet been in any official release)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolxc: eliminate leaked and dangling pointers in virLXCProcessSetupInterfaceTap
Laine Stump [Wed, 6 Jan 2021 18:44:40 +0000 (13:44 -0500)] 
lxc: eliminate leaked and dangling pointers in virLXCProcessSetupInterfaceTap

The two scenarios were found by Coverity after a seemingly-unrelated
change to virLXCProcessSetupInterfaceTap() (in commit ecfc2d5f43), and
explained by John Ferlan here:

https://www.redhat.com/archives/libvir-list/2020-December/msg00810.html

To re-explain:

a) On entry to virLXCProcessSetupInterfaceTap() if net->ifname != NULL
   then a copy of net->ifname is made into parentVeth, and a reference
   to *that* pointer is sent down to virNetDevVethCreate().

b) If parentVeth (aka net->ifname) is a template name (e.g. "blah%d"),
   then virNetDevVethCreate() calls virNetDevGenerateName(), and if
   virNetDevGenerateName() successfully generates a usable name
   (e.g. "blah27") then it will free the original template string
   (which is pointed to by net->ifname and by parentVeth), then
   replace the pointer in parentVeth with a pointer to the new
   string. Note that net->ifname still points to the now-freed
   template string.

c) returning back up to virLXCProcessSetupInterfaceTap(), we check if
   net->ifname == NULL - it *isn't* (still contains stale pointer to
   template string), so we don't replace it with the pointer to the new
   string that is in parentVeth.

d) Result: the new string is leaked once we return from
   virLXCProcessSetupInterfaceTap(), while there is a dangling pointer
   to the old string in net->ifname.

There is also a leak if there is a failure somewhere between steps (b)
and (c) above - the failure cleanup in virNetDevVethCreate() will only
free the newly-generated parentVeth string if the original pointer was
NULL (narrator: "It wasn't."). But it's a new string allocated by
virNetDevGenerateName(), not the original string from net->ifname, so
it really does need to be freed.

The solution is to make a copy of the entire original string into a
g_autofree pointer, then iff everything is successful we g_free() the
original net->ifname and replace it by stealing the string returned by
virNetDevVethCreate().

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolxc: remove unnecessary call to virNetDevReserveName()
Laine Stump [Mon, 21 Dec 2020 01:35:02 +0000 (20:35 -0500)] 
lxc: remove unnecessary call to virNetDevReserveName()

In all cases *except* when parsing status XML as libvirt is being
restarted, the XML parser will delete any manually specified interface
name (aka "<target dev='blah'/>" aka net->ifname) that could have been
generated by virNetDevGenerateName(). This means that during the setup
when a domain is being started (e.g. during
virLXCProcessSetupInterfaceTap()) it is pointless to call
virNetDevReserveName() with any setting of net->ifname that has come
from the XML parser - it is guaranteed to not fit the pattern of any
auto-generated name, and so the call is just a NOP anyway.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu_map: Define and enable Snowridge model
Tim Wiederhake [Wed, 6 Jan 2021 10:05:11 +0000 (11:05 +0100)] 
cpu_map: Define and enable Snowridge model

Due to missing pdpe1gb support in the host CPU data, the CPU is still
incorrectly detected as Westmere-IBRS for host capabilities because we
don't have the option to disable features included in the base model
there.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu_map: Add support for split-lock-detect CPU feature
Tim Wiederhake [Wed, 6 Jan 2021 10:05:09 +0000 (11:05 +0100)] 
cpu_map: Add support for split-lock-detect CPU feature

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu_map: Add support for core-capability CPU feature
Tim Wiederhake [Wed, 6 Jan 2021 10:05:07 +0000 (11:05 +0100)] 
cpu_map: Add support for core-capability CPU feature

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu_map: Add support for fsrm CPU feature
Tim Wiederhake [Wed, 6 Jan 2021 10:05:06 +0000 (11:05 +0100)] 
cpu_map: Add support for fsrm CPU feature

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocputestdata: Add test data for Snowridge
Tim Wiederhake [Wed, 6 Jan 2021 10:05:05 +0000 (11:05 +0100)] 
cputestdata: Add test data for Snowridge

It's obvious the CPU model detection provides strange results, which
will be fixed by adding a new Snowridge CPU model few patches later.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agonetwork: Introduce mutex for bridge name generation
Michal Privoznik [Thu, 7 Jan 2021 14:51:02 +0000 (15:51 +0100)] 
network: Introduce mutex for bridge name generation

When defining/creating a network the bridge name may be filled in
automatically by libvirt (if none provided in the input XML or
the one provided is a pattern, e.g. "virbr%d"). During the
bridge name generation process a candidate name is generated
which is then checked with the rest of already defined/running
networks for collisions.

Problem is, that there is no mutex guarding this critical section
and thus if two threads line up so that they both generate the
same candidate they won't find any collision and the same name is
then stored.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/78
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemuMonitorFdsetsFree: Don't leak @set->fds
Michal Privoznik [Thu, 7 Jan 2021 13:22:17 +0000 (14:22 +0100)] 
qemuMonitorFdsetsFree: Don't leak @set->fds

The @fds member of qemuMonitorFdsetInfo struct is an array and as
such, it's allocated in qemuMonitorJSONQueryFdsetsParse() but not
freed in qemuMonitorFdsetsFree().

Fixes: b8998cc670f7b1b11a83276050e49dce7efba333
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: Simplify expression of supported platforms
Neal Gompa [Thu, 7 Jan 2021 14:58:08 +0000 (09:58 -0500)] 
rpm: Simplify expression of supported platforms

Stanzas like "0%{?fedora} && 0%{?fedora} >= %{min_fedora}" contain
redundant definitions, as "0%{?fedora} >= %{min_fedora}" implies that
"%fedora" is defined and has a value. Thus, we can simplify this.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-gather: Merge cpu-cpuid.py
Tim Wiederhake [Mon, 4 Jan 2021 11:30:19 +0000 (12:30 +0100)] 
cpu-gather: Merge cpu-cpuid.py

Old usage:
  cpu-cpuid.py diff FILE...
New usage:
  cpu-gather.py diff FILE...

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-gather: Factor out call to cpu-cpuid.py
Tim Wiederhake [Mon, 4 Jan 2021 11:30:18 +0000 (12:30 +0100)] 
cpu-gather: Factor out call to cpu-cpuid.py

This is a preparatory step to merge cpu-cpuid.py.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-gather: Use actions instead of flags for action argument
Tim Wiederhake [Mon, 4 Jan 2021 11:30:17 +0000 (12:30 +0100)] 
cpu-gather: Use actions instead of flags for action argument

This allows for the functionality of cpu-cpuid.py script to be
integrated more naturally in a later patch.

Changes the way this script should be called:
  cpu-gather.py                   -> cpu-gather.py
  cpu-gather.py --gather          -> cpu-gather.py gather
  cpu-gather.py --parse           -> cpu-gather.py parse
  cpu-gather.py --gather --parse  -> cpu-gather.py full

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Deduplicate register list
Tim Wiederhake [Mon, 4 Jan 2021 11:30:16 +0000 (12:30 +0100)] 
cpu-cpuid: Deduplicate register list

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Merge checkFeature functions
Tim Wiederhake [Mon, 4 Jan 2021 11:30:15 +0000 (12:30 +0100)] 
cpu-cpuid: Merge checkFeature functions

Prepare to deduplicate the list of relevant registers for cpuid and
msr information.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Merge addFeature functions
Tim Wiederhake [Mon, 4 Jan 2021 11:30:14 +0000 (12:30 +0100)] 
cpu-cpuid: Merge addFeature functions

Prepare to deduplicate the list of relevant registers for cpuid and
msr information.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Remove xmltodict usage in parseCPU
Tim Wiederhake [Mon, 4 Jan 2021 11:30:13 +0000 (12:30 +0100)] 
cpu-cpuid: Remove xmltodict usage in parseCPU

'xmltodict' is a Python module that is not installed by default.
Replace it, so the dependencies of cpu-gather.py do not change
when both scripts are merged.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Remove xmltodict usage in parseMap
Tim Wiederhake [Mon, 4 Jan 2021 11:30:12 +0000 (12:30 +0100)] 
cpu-cpuid: Remove xmltodict usage in parseMap

'xmltodict' is a Python module that is not installed by default.
Replace it, so the dependencies of cpu-gather.py do not change
when both scripts are merged.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agocpu-cpuid: Use argparse to parse arguments
Tim Wiederhake [Mon, 4 Jan 2021 11:30:11 +0000 (12:30 +0100)] 
cpu-cpuid: Use argparse to parse arguments

Using 'argparse' for argument handling simplifies merging this script
with cpu-gather.py in a later patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agosrc: fix resource leak introduced in d4439a6b8
Nikolay Shirokovskiy [Thu, 7 Jan 2021 13:09:19 +0000 (16:09 +0300)] 
src: fix resource leak introduced in d4439a6b8

@tmp that was copied just above is leaked on plain return.
The issue is found by Coverity.

Patch that inroduced a leak:
d4439a6b8 : src: adopt to VIR_DRV_SUPPORTS_FEATURE return -1

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: build fix for 910b94df
Nick Shyrokovskiy [Wed, 6 Jan 2021 15:40:51 +0000 (18:40 +0300)] 
qemu: build fix for 910b94df

Fixes compiler error:

src/qemu/qemu_migration.c:4814:20: error: ‘dstOffline’ may be used
    uninitialized in this function [-Werror=maybe-uninitialized]
    4814 |     if (offline && !dstOffline) {

The commit that introduced the error:
910b94df: qemu: adopt to VIR_DRV_SUPPORTS_FEATURE return -1

Signed-off-by: Nick Shyrokovskiy <nshyrokovskiy@gmail.com>
4 years agoqemuDomainChangeNet: Check changed virtio network driver options
Tim Wiederhake [Wed, 6 Jan 2021 11:12:40 +0000 (12:12 +0100)] 
qemuDomainChangeNet: Check changed virtio network driver options

Changes to a virtio network device such as
  <interface type="network">
    <model type="virtio"/>
    <driver iommu="on" ats="on"/> <!-- this line added -->
    ...
  </interface>
were quietly dismissed by `virsh update-device ... --live`.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agosrc: don't hide error in VIR_DRV_SUPPORTS_FEATURE
Nikolay Shirokovskiy [Fri, 18 Dec 2020 06:40:04 +0000 (09:40 +0300)] 
src: don't hide error in VIR_DRV_SUPPORTS_FEATURE

Otherwise we can get misleading error messages. One example is when connection
is broken we got "this function is not supported by the connection driver:
virDomainMigrate3" from virDomainMigrate3.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>