]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agomeson: Use dependency() when possible
Andrea Bolognani [Wed, 26 May 2021 16:46:20 +0000 (18:46 +0200)] 
meson: Use dependency() when possible

This is the preferred way to figure out whether a library is
available, and for the most part we can just adopt it right
away; in a few cases, unfortunately, we're stuck with using
cc.find_library() until further down the road, when all our
target platforms ship with pkg-config enabled versions of the
various libraries.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Rewrite libacl check
Andrea Bolognani [Wed, 26 May 2021 16:42:40 +0000 (18:42 +0200)] 
meson: Rewrite libacl check

libacl is Linux-only, so we don't need to explicitly check for
either the target platform or header availability, and we can
simply rely on cc.find_library() instead. The corresponding
preprocessor define is renamed to more accurately reflect the
nature of the check.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Fix firewalld check
Andrea Bolognani [Wed, 26 May 2021 15:33:08 +0000 (17:33 +0200)] 
meson: Fix firewalld check

firewalld is Linux-only, so it should be disabled by default
everywhere else and attempts to explicitly enable firewalld
support on non-Linux targets should result in an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Rewrite firewalld check
Andrea Bolognani [Wed, 26 May 2021 15:31:03 +0000 (17:31 +0200)] 
meson: Rewrite firewalld check

This makes it possible to explicitly disable firewalld support
regardless of the platform that's being targeted.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Fix disabling netcf
Andrea Bolognani [Thu, 27 May 2021 14:09:54 +0000 (16:09 +0200)] 
meson: Fix disabling netcf

If the feature is disabled, the corresponding flags should not
show up in the compiler command line.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Tweak XDR check
Andrea Bolognani [Wed, 26 May 2021 13:13:42 +0000 (15:13 +0200)] 
meson: Tweak XDR check

Keep all the platform-specific code in one place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Rewrite polkit check
Andrea Bolognani [Tue, 25 May 2021 16:14:09 +0000 (18:14 +0200)] 
meson: Rewrite polkit check

The new version will report an error if the user asks for
polkit support to be enabled on Windows instead of silently
ignoring such requests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Fix sanlock detection
Andrea Bolognani [Thu, 27 May 2021 14:35:38 +0000 (16:35 +0200)] 
meson: Fix sanlock detection

If the user explicitly asked for sanlock support to be enabled,
then failure to find the corresponding library should result in
an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Fix vstorage detection
Andrea Bolognani [Wed, 26 May 2021 15:47:05 +0000 (17:47 +0200)] 
meson: Fix vstorage detection

We're supposed to error out if the user has explicitly asked
for vstorage support to be enabled and that can't be done, but
we've been looking at the wrong option.

Fixes: 2127d53f2f90443f3e4919c1082350ee2b3096f1
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Drop numactl_version
Andrea Bolognani [Wed, 26 May 2021 18:08:40 +0000 (20:08 +0200)] 
meson: Drop numactl_version

It's not used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Make libm a required dependency
Andrea Bolognani [Thu, 27 May 2021 17:34:50 +0000 (19:34 +0200)] 
meson: Make libm a required dependency

We use it unconditionally.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Use built-in pcap detection
Andrea Bolognani [Wed, 26 May 2021 16:20:04 +0000 (18:20 +0200)] 
meson: Use built-in pcap detection

Meson already knows how to look for pcap using pkg-config
first, and falling back to pcap-config if that didn't work.

https://mesonbuild.com/Dependencies.html#pcap

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Use get_pkgconfig_variable('cflags')
Andrea Bolognani [Wed, 26 May 2021 17:03:16 +0000 (19:03 +0200)] 
meson: Use get_pkgconfig_variable('cflags')

Meson offers a native convenience method that can be used to
fetch pkg-config variables from a dependency, so we can use
that instead of calling pkg-config manually.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Drop netinet workaround
Andrea Bolognani [Wed, 26 May 2021 16:30:06 +0000 (18:30 +0200)] 
meson: Drop netinet workaround

It appears to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Drop curl workaround
Andrea Bolognani [Wed, 26 May 2021 17:10:17 +0000 (19:10 +0200)] 
meson: Drop curl workaround

It appears to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Don't use 'required: true'
Andrea Bolognani [Thu, 27 May 2021 17:04:10 +0000 (19:04 +0200)] 
meson: Don't use 'required: true'

It's the default.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Whitespace tweaks
Andrea Bolognani [Thu, 27 May 2021 16:29:02 +0000 (18:29 +0200)] 
meson: Whitespace tweaks

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agospec: Be explicit about more features
Andrea Bolognani [Thu, 27 May 2021 18:57:57 +0000 (20:57 +0200)] 
spec: Be explicit about more features

We want to be explicit about which features are enabled in our
RPM build instead of relying on default values.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoPost-release version bump to 7.5.0
Jiri Denemark [Tue, 1 Jun 2021 10:05:41 +0000 (12:05 +0200)] 
Post-release version bump to 7.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-7.4.0 v7.4.0
Jiri Denemark [Tue, 1 Jun 2021 09:57:28 +0000 (11:57 +0200)] 
Release of libvirt-7.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoNEWS: disks: Mention <transient> improvements and <slice> XML fix
Peter Krempa [Tue, 1 Jun 2021 07:22:05 +0000 (09:22 +0200)] 
NEWS: disks: Mention <transient> improvements and <slice> XML fix

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemuProcessSetupDisksTransientSnapshot: Skip enabling transientOverlayCreated flag
Masayoshi Mizuma [Thu, 27 May 2021 16:55:12 +0000 (12:55 -0400)] 
qemuProcessSetupDisksTransientSnapshot: Skip enabling transientOverlayCreated flag

QEMU_DOMAIN_DISK_PRIVATE(disk)->transientOverlayCreated flag
gets true unexpectedly on qemuProcessSetupDisksTransientSnapshot() when
the disk has <transient shareBacking='yes'> option.

The flag should be enabled on qemuDomainAttachDiskGeneric() after the
overlay setup is completed.

Skip enabling transientOverlayCreated for the disk here.

Fixes: 75871da0ecb8b552f9e304d0f83e216839bbf82d
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonodedev: Revert auto-start property for mdevs v7.4.0-rc2
Jonathon Jongsma [Wed, 26 May 2021 15:40:26 +0000 (10:40 -0500)] 
nodedev: Revert auto-start property for mdevs

We supported autostart of node devices via an xml element, but this
is not consistent with other libvirt objects which use an explicit API
for setting autostart status. So revert this and implement it as an
official API in a future commit.

The initial support was refactored after merging, so this commit reverts
both of those previous commits.

Revert "virNodeDevCapMdevParseXML: Use virXMLPropEnum() for ./start/@type"
This reverts commit 9d4cd1d1cda84aa15b77a506f2ad6362a74edf1a.

Revert "nodedev: support auto-start property for mdevs"
This reverts commit 42a558549935336cbdb7cbfe8b239ffb0e3442e3.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoPartial Revert of "tests: nodedevxml2xmltest: test more mdev files"
Jonathon Jongsma [Wed, 26 May 2021 15:40:25 +0000 (10:40 -0500)] 
Partial Revert of "tests: nodedevxml2xmltest: test more mdev files"

This reverts parts of commit bb8c3b61208ed0f29dcbeca857529600f04b3146
that added tests for autostart functionality (which will be reverted in
the following commit)

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoremote: fix regression connecting to remote session daemon
Daniel P. Berrangé [Mon, 24 May 2021 15:36:15 +0000 (16:36 +0100)] 
remote: fix regression connecting to remote session daemon

While we couldn't historically connect to the remote session daemon
automatically, we do allow the user to set an explicit socket path
to enable the connections to work. This ability was accidentally
lost in

  commit f8ec7c842df9e40c6607eae9b0223766cb226336
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Jul 8 17:03:38 2020 +0100

    rpc: use new virt-ssh-helper binary for remote tunnelling

We need to force use of 'netcat' when a 'socket' path is given in
the URI parameters.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: move proxy/mode defaults after URI parsing
Daniel P. Berrangé [Mon, 24 May 2021 15:35:19 +0000 (16:35 +0100)] 
remote: move proxy/mode defaults after URI parsing

Currently the defaults for the proxy/mode settings are set before
parsing URI parameters. A following commit will introduce a dependancy
on the URI parsing for the defaults, so they need to move.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirCapabilitiesHostNUMAInitReal: Don't jump over cleanup
Michal Privoznik [Thu, 27 May 2021 09:42:19 +0000 (11:42 +0200)] 
virCapabilitiesHostNUMAInitReal: Don't jump over cleanup

In one of my recent commits I've done some renaming. But whilst
doing so I also mistakenly replaced 'goto cleanup' with 'return
-1' in virCapabilitiesHostNUMAInitReal() which was incorrect.

Fixes: fe25224fdaa53bbeceed3ddeef1b3a150665e656
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoremote: stop checking for errors from socket allocations
Daniel P. Berrangé [Mon, 24 May 2021 11:21:32 +0000 (12:21 +0100)] 
remote: stop checking for errors from socket allocations

The remoteGetUNIXSocketHelper method always returns a non-NULL string.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: use absolute path to check for daemons
Daniel P. Berrangé [Mon, 24 May 2021 10:06:23 +0000 (11:06 +0100)] 
remote: use absolute path to check for daemons

virFileFindResource needs to be given the absolute build path otherwise
its results will vary according to the CWD, leading to spurious failures
in dev testing.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 27 May 2021 06:02:58 +0000 (08:02 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10314 of 10314 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 agoTranslated using Weblate (Finnish)
Jan Kuparinen [Thu, 27 May 2021 06:02:58 +0000 (08:02 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 20.9% (2158 of 10314 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 agoUpdate translation files
Weblate [Thu, 27 May 2021 06:02:55 +0000 (08:02 +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 agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 27 May 2021 06:02:51 +0000 (08:02 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 20.5% (2164 of 10516 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
4 years agoqemuDomainAttachDiskGenericTransient: Add NULL check in case the overlay disk already...
Masayoshi Mizuma [Wed, 26 May 2021 20:19:22 +0000 (16:19 -0400)] 
qemuDomainAttachDiskGenericTransient: Add NULL check in case the overlay disk already exists

When <transient shareBacking='yes'> is set to a disk and the overlay
disk already exists because of something abnormal, libvirt is terminated
by Segmentation fault.

  # virsh start Test0
  error: Disconnected from qemu:///system due to end of file
  error: Failed to start domain 'Test0'
  error: End of file while reading data: Input/output error

Add NULL check for snapdiskdef so that the rollback can work correctly.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Fixes: 2e94002d2ace4e4a6dbfc13a84fdab28f22c5c4a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agopo: Refresh potfile for v7.4.0 v7.4.0-rc1
Jiri Denemark [Tue, 25 May 2021 15:04:51 +0000 (17:04 +0200)] 
po: Refresh potfile for v7.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemu: adjust the maxmemlock limit when hotplugging a vDPA device
Laine Stump [Fri, 21 May 2021 18:51:05 +0000 (14:51 -0400)] 
qemu: adjust the maxmemlock limit when hotplugging a vDPA device

and re-adjust if the hotplug fails.

This fixes a bug found during testing of
https://bugzilla.redhat.com/1939776, which was supposed to be resolved
by commit 98e22ff749, but failed to account for the case of device
hotplug.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_hotplug.c: add net devices to the domain list earlier
Laine Stump [Fri, 21 May 2021 18:32:00 +0000 (14:32 -0400)] 
qemu_hotplug.c: add net devices to the domain list earlier

An upcoming patch will be checking if the addition of a new net device
requires adjusting the domain locked memory limit, which must be done
prior to sending the command to qemu to add the new device. But
qemuDomainAdjustMaxMemLock() checks all (and only) the devices that
are currently in the domain definition, and currently we are adding
new net devices to the domain definition only at the very end of the
hotplug operation, after qemu has already executed the device_add
command.

In order for the upcoming patch to work, this patch changes
qemuDomainAttachNetDevice() to add the device to the domain nets list
at an earlier time. It can't be added until after PCI address and
alias name have been determined (because both of those examine
existing devices in the domain to figure out a unique value for the
new device), but must be done before making the qemu monitor call.

Since the device has been added to the list earlier, we need to
potentially remove it on failure. This is done by replacing the
existing call to virDomainNetRemoveHostdev() (which checks if this is
a hostdev net device, and if so removes it from the hostdevs list,
since it could have already been added to that list) with a call to
the new virDomainNetRemoveByObj(), which looks for the device on both
nets and hostdevs lists, and removes it where it finds it.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: new function virDomainNetRemoveByObj()
Laine Stump [Fri, 21 May 2021 18:28:10 +0000 (14:28 -0400)] 
conf: new function virDomainNetRemoveByObj()

virDomainNetRemove() requires the index of the net device you want to
remove from the list, but in some cases you may not have the index
handy, only the object itself (or the object may not have been added
to the domain's list). virDomainNetRemoveByObj() first tries to find
the given object in the nets list, and deletes that if it is found.

As with virDomainNetRemove() it always unconditionally tries to remove
the device from the hostdevs list (in case it is the ridiculous
combined net+hostdev device created for <interface type='hostdev'>).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_hotplug.c: don't skip cleanup on failures of qemuDomainAttachNetDevice
Laine Stump [Fri, 21 May 2021 17:03:17 +0000 (13:03 -0400)] 
qemu_hotplug.c: don't skip cleanup on failures of qemuDomainAttachNetDevice

We have many places where the earliest error returns from a function
skip any cleanup label at the bottom (the assumption being that it is
so early in the function that there isn't yet anything that needs to
be explicitly undone on failure). But in general it is a bad sign if
there are any direct "return" statements in a function at any time
after there has been a "goto cleanup" - that indicates someone thought
that an earlier point in the code had done something needing cleanup,
so we shouldn't be skipping it.

There were two occurences of a "return -1" after "goto cleanup" in
qemuDomainAttachDeviceNet(). The first of these has been around for a
very long time (since 2013) and my assumption is that the earlier
"goto cleanup" didn't exist at that time (so it was proper), and when
the code further up in the function was added, the this return -1 was
missed. The second was added during a mass change to check the return
from qemuInterfacePrepareSlirp() in several places (commit
99a1cfc43889c6d); in this case it was erroneous from the start.

Change both of these "return -1"s to "goto cleanup". Since we already
have code paths earlier in the function that goto cleanup, this should
not cause any new problem.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Fix %endif indentation
Michal Privoznik [Tue, 25 May 2021 11:20:06 +0000 (13:20 +0200)] 
spec: Fix %endif indentation

In recent commit f772c1fd2a a misaligned %endif sneaked in which
upsets syntax-check. Align it properly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirxml: Avoid double indentation of <metadata/> element
Michal Privoznik [Tue, 25 May 2021 09:32:37 +0000 (11:32 +0200)] 
virxml: Avoid double indentation of <metadata/> element

There was a recent change in libxml2 that caused a trouble for
us. To us, <metadata/> in domain or network XMLs are just opaque
value where management application can store whatever data it
finds fit. At XML parser/formatter level, we just make a copy of
the element during parsing and then format it back. For
formatting we use xmlNodeDump() which allows caller to specify
level of indentation. Previously, the indentation was not
applied onto the very first line, but as of v2.9.12-2-g85b1792e
libxml2 is applying indentation also on the first line.

This does not work well with out virBuffer because as soon as we
call virBufferAsprintf() to append <metadata/> element,
virBufferAsprintf() will apply another level of indentation.

Instead of version checking, let's skip any indentation added by
libxml2 before virBufferAsprintf() is called.

Note, the problem is only when telling xmlNodeDump() to use
indentation, i.e. level argument is not zero. Therefore,
virXMLNodeToString() which also calls xmlNodeDump() is safe as it
passes zero.

Tested-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirxml: Report error if virXMLFormatMetadata() fails
Michal Privoznik [Tue, 25 May 2021 09:30:33 +0000 (11:30 +0200)] 
virxml: Report error if virXMLFormatMetadata() fails

I guess this is more of an academic problem, because if
<metadata/> content was problematic we would have caught the
error during parsing. Anyway, as is this function returns -1
without any error reported. Fix it by reporting one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirxml: Introduce and use virXMLFormatMetadata()
Michal Privoznik [Tue, 25 May 2021 09:21:02 +0000 (11:21 +0200)] 
virxml: Introduce and use virXMLFormatMetadata()

So far, we have to places where we format <metadata/> into XMLs:
domain and network. Bot places share the same code. Move it into
a helper function and just call it from those places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agorpm: disable glusterfs on RHEL-9
Daniel P. Berrangé [Fri, 14 May 2021 11:56:23 +0000 (12:56 +0100)] 
rpm: disable glusterfs on RHEL-9

Support for glusterfs with KVM is being dropped in RHEL-9 in the
virtualization stack.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: re-enable ppc64 on RHEL-8
Daniel P. Berrangé [Fri, 14 May 2021 11:49:19 +0000 (12:49 +0100)] 
rpm: re-enable ppc64 on RHEL-8

Historically PowerPC 64 was always supported with qemu-kvm in RHEL.

In future RHEL-9 it is being discontinued and this was addressed
in

  commit 03cc3c9064322ac4028a2213105cd230fe28c013
  Author: Jiri Denemark <jdenemar@redhat.com>
  Date:   Wed Apr 21 14:55:03 2021 +0200

    spec: Do not build qemu driver for Power on RHEL-9

when the specfile was cleaned up to remove RHEL-7 support:

  commit 0f601d2f868f2017cdd16e0a7ca90a59e7d5e120
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Wed May 5 19:30:46 2021 +0200

    spec: Bump min_fedora and min_rhel

it also removed the logic that applied to RHEL-8 wrt arch list
and lost PowerPC 64 support on 8. This reverts that part of the
change but with the condition reversed to prioritize the future
state.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolibxl: Break down an if() in libxlCapsInitNuma()
Michal Privoznik [Wed, 12 May 2021 12:12:53 +0000 (14:12 +0200)] 
libxl: Break down an if() in libxlCapsInitNuma()

There's an if-else statement in libxlCapsInitNuma() that can
really be just two standalone if()-s. Writing it as such helps
with code readability.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agotests: Add qemuxml2argv and qemuxml2xml test for <transient shareBacking='yes'>
Peter Krempa [Fri, 21 May 2021 12:13:50 +0000 (14:13 +0200)] 
tests: Add qemuxml2argv and qemuxml2xml test for <transient shareBacking='yes'>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Allow <transient> disks with images shared accross VMs
Peter Krempa [Tue, 18 May 2021 09:15:50 +0000 (11:15 +0200)] 
qemu: Allow <transient> disks with images shared accross VMs

Implement this behaviour by skipping the disks on traditional
commandline and hotplug them before resuming CPUs. That allows to use
the support for hotplugging of transient disks which inherently allows
sharing of the backing image as we open it read-only.

This commit implements the validation code to allow it only with buses
supporting hotplug and the hotplug code while starting up the VM.

When we have such disk we need to issue a system-reset so that firmware
tables are regenerated to allow booting from such device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: Introduce 'shareBacking' for <transient> disks
Peter Krempa [Tue, 18 May 2021 09:11:02 +0000 (11:11 +0200)] 
conf: Introduce 'shareBacking' for <transient> disks

In case the user wants to share the disk image between multiple VMs the
qemu driver needs to hotplug such disks to instantiate the backends.
Since that doesn't work for all disk configs add a switch to force this
behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Export
Peter Krempa [Tue, 18 May 2021 14:19:52 +0000 (16:19 +0200)] 
qemuDomainAttachDiskGeneric: Export

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Pass the qemu async job type
Peter Krempa [Tue, 18 May 2021 14:18:53 +0000 (16:18 +0200)] 
qemuDomainAttachDiskGeneric: Pass the qemu async job type

The qemuDomainAttachDiskGeneric will also be used on startup for
transient disks which share the overlay. The VM startup code passes the
asyncJob around so we need to pass it into qemuDomainAttachDiskGeneric.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Implement hotplug of <transient> disk
Peter Krempa [Thu, 13 May 2021 11:05:27 +0000 (13:05 +0200)] 
qemuDomainAttachDiskGeneric: Implement hotplug of <transient> disk

Add code which creates the transient overlay after hotplugging the disk
backend before attaching the disk frontend.

The state of the topmost image is modified to be already read-only to
prevent the need to open the image in read-write mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Track creation of <transient> disk overlay individually
Peter Krempa [Tue, 18 May 2021 15:47:48 +0000 (17:47 +0200)] 
qemu: Track creation of <transient> disk overlay individually

In preparation for hotplug of <transient> disks we'll need to track
whether the overlay file was created individually per-disk.

Add 'transientOverlayCreated' to 'struct _qemuDomainDiskPrivate' and
remove 'inhibitDiskTransientDelete' from 'qemuDomainObjPrivate' and
adjust the code for the change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Split up frontend and backend attachment
Peter Krempa [Fri, 21 May 2021 08:34:55 +0000 (10:34 +0200)] 
qemuDomainAttachDiskGeneric: Split up frontend and backend attachment

Split up the monitor contexts to attach the backend of the disk and the
frontend device in preparation for hotplugging transient disks where
we'll need to add the code for adding the transient overlay between
these two steps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Refactor rollback handling
Peter Krempa [Wed, 12 May 2021 11:10:49 +0000 (13:10 +0200)] 
qemuDomainAttachDiskGeneric: Refactor rollback handling

Modify the rollback section to use its own monitor context so that we
can later split up the hotplug into multiple steps and move the
detachment of the extension device into the rollback section rather than
doing it inline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Move PR helper attach into qemuDomainAttachDeviceDiskLiv...
Peter Krempa [Fri, 21 May 2021 08:37:36 +0000 (10:37 +0200)] 
qemuDomainAttachDiskGeneric: Move PR helper attach into qemuDomainAttachDeviceDiskLiveInternal

Similarly to previous refactors we want to move all hotplug related
setup which isn't strictly relevant to attaching the disk into
qemuDomainAttachDeviceDiskLiveInternal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Refactor cleanup
Peter Krempa [Thu, 20 May 2021 15:16:39 +0000 (17:16 +0200)] 
qemuDomainAttachDiskGeneric: Refactor cleanup

Remove the 'ret' variable and 'cleanup' label in favor of directly
returning the value since we don't have anything under the 'cleanup:'
label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Fix whitespace
Peter Krempa [Thu, 20 May 2021 15:08:27 +0000 (17:08 +0200)] 
qemuDomainAttachDiskGeneric: Fix whitespace

Remove two empty lines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDis...
Peter Krempa [Tue, 18 May 2021 14:11:52 +0000 (16:11 +0200)] 
qemu: hotplug: Move post-insertion steps of disk hotplug to qemuDomainAttachDeviceDiskLiveInternal

Move the auditing entry and insertion into the disk definition from the
function which deals with qemu to 'qemuDomainAttachDeviceDiskLiveInternal'
which deals with the hotplug related specifics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Move setup of disk into qemuDomainAttachDeviceDiskLiveIn...
Peter Krempa [Tue, 18 May 2021 13:50:06 +0000 (15:50 +0200)] 
qemuDomainAttachDiskGeneric: Move setup of disk into qemuDomainAttachDeviceDiskLiveInternal

qemuDomainAttachDeviceDiskLiveInternal already sets up certain pieces of
the disk definition so it's better suited to move the setup of the
virStorageSource structs, granting access to the storage and allocation
of the alias from qemuDomainAttachDiskGeneric which will be just
handling the qemu interaction.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDeviceDiskLiveInternal: Simplify call to qemuDomainAttachDiskGeneric
Peter Krempa [Tue, 18 May 2021 13:18:01 +0000 (15:18 +0200)] 
qemuDomainAttachDeviceDiskLiveInternal: Simplify call to qemuDomainAttachDiskGeneric

We can call it in one place as all per-device-type subcases use the same
code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachSCSIDisk
Peter Krempa [Tue, 18 May 2021 13:10:22 +0000 (15:10 +0200)] 
qemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachSCSIDisk

Move the validation of the SCSI device address and the attachment of the
controller into qemuDomainAttachDeviceDiskLiveInternal as there's no
specific need for a special helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachVirtioDiskDevice
Peter Krempa [Tue, 18 May 2021 13:10:22 +0000 (15:10 +0200)] 
qemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachVirtioDiskDevice

Move the specific device setup and address reservation code into the
main hotplug helper as it's just one extra function call.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachUSBMassStorageDevice
Peter Krempa [Tue, 18 May 2021 13:10:22 +0000 (15:10 +0200)] 
qemuDomainAttachDeviceDiskLiveInternal: Absorb qemuDomainAttachUSBMassStorageDevice

Move the specific device setup and address reservation code into the
main hotplug helper as it's just one extra function call.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainRemoveDiskDevice: Move 'copy-on-read' handling to qemuBlockStorageSourceCha...
Peter Krempa [Fri, 7 May 2021 12:54:31 +0000 (14:54 +0200)] 
qemuDomainRemoveDiskDevice: Move 'copy-on-read' handling to qemuBlockStorageSourceChainData

Unify the handling of the copy-on-read filter by changing the handling
to use qemuBlockStorageSourceChainData.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainAttachDiskGeneric: Move 'copy-on-read' handling to qemuBlockStorageSourceCh...
Peter Krempa [Fri, 7 May 2021 12:50:23 +0000 (14:50 +0200)] 
qemuDomainAttachDiskGeneric: Move 'copy-on-read' handling to qemuBlockStorageSourceChainData

Fill in the required fields in qemuBlockStorageSourceChainData to handle
the hotplug so that we can simplify the cleanup code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuBlockStorageSourceChainData: Add handling of 'copy-on-read' filter layer
Peter Krempa [Fri, 7 May 2021 12:48:02 +0000 (14:48 +0200)] 
qemuBlockStorageSourceChainData: Add handling of 'copy-on-read' filter layer

qemuBlockStorageSourceChainData encapsulates the backend of the disk for
startup and hotplug operations. Add the handling for the copy-on-read
filter so that the hotplug code doesn't need to have separate cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: remove virDomainDiskInsertPreAlloced
Peter Krempa [Tue, 18 May 2021 14:02:18 +0000 (16:02 +0200)] 
conf: remove virDomainDiskInsertPreAlloced

Replace the last use of the function by virDomainDiskInsert and remove
the unused helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoReplace virDomainDiskInsertPreAlloced by virDomainDiskInsert
Peter Krempa [Tue, 18 May 2021 14:00:48 +0000 (16:00 +0200)] 
Replace virDomainDiskInsertPreAlloced by virDomainDiskInsert

Pre-extending the disk array size is pointless nowadays since we've
switched to memory APIs which don't return failure.

Switch all uses of reallocation of the array followed by
'virDomainDiskInsertPreAlloced' with direct virDomainDiskInsert.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Move iothread and s390 address validation for disk devices into the validator
Peter Krempa [Fri, 30 Apr 2021 14:19:15 +0000 (16:19 +0200)] 
qemu: Move iothread and s390 address validation for disk devices into the validator

The "machine-loadparm-multiple-disks-nets-s390" case now requires the
QEMU_CAPS_CCW feature to pass validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove pointless tests for keywrapping on s390
Peter Krempa [Fri, 30 Apr 2021 14:29:45 +0000 (16:29 +0200)] 
qemuxml2argvtest: Remove pointless tests for keywrapping on s390

There were two negative tests for the keywrapping feature on s390 when
the feature flag was missing. For now both shared the error message thus
worked fine, but with the upcoming patch to move some disk validation
code from the command line formatter to validation code will change the
error message in case the disk capabilities are missing.

Drop the test cases which don't provide any capability and keep those
that have the disk capabilities present as they are sufficient to prove
the feature.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Move bootindex usage logic into qemuBuildDiskDeviceStr
Peter Krempa [Fri, 30 Apr 2021 14:09:09 +0000 (16:09 +0200)] 
qemu: Move bootindex usage logic into qemuBuildDiskDeviceStr

We can skip the formatting of the bootindex for floppies directly at the
place where it's being formatted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Move 'bootindex' handling for disks out of command line formatter
Peter Krempa [Fri, 30 Apr 2021 06:58:45 +0000 (08:58 +0200)] 
qemu: Move 'bootindex' handling for disks out of command line formatter

The logic assigning the bootindices from the legacy boot order
configuration was spread through the command line formatters for the
disk device and for the floppy controller.

This patch adds 'effectiveBootindex' property to the disk private data
which holds the calculated boot index and moves the logic of determining
the boot index into 'qemuProcessPrepareDomainDiskBootorder' called from
'qemuProcessPrepareDomainStorage'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu_snapshot: Add the guest name to the transient disk path
Masayoshi Mizuma [Thu, 25 Mar 2021 00:54:11 +0000 (20:54 -0400)] 
qemu_snapshot: Add the guest name to the transient disk path

Later patches will implement sharing of the backing file, so we'll need
to be able to discriminate the overlays per VM.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: snapshot: move transient snapshot code to qemu_process
Peter Krempa [Tue, 27 Apr 2021 18:31:11 +0000 (20:31 +0200)] 
qemu: snapshot: move transient snapshot code to qemu_process

The code deals with the startup of the VM and just uses the snapshot
code to achieve the desired outcome.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuSnapshotDiskCreate: Use 'cfg' from the qemuSnapshotDiskContext
Peter Krempa [Wed, 28 Apr 2021 12:19:36 +0000 (14:19 +0200)] 
qemuSnapshotDiskCreate: Use 'cfg' from the qemuSnapshotDiskContext

We store the virQEMUDriverConfig object in the context.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuSnapshotDiskPrepareOne: Use data from qemuSnapshotDiskContext
Peter Krempa [Wed, 28 Apr 2021 12:16:37 +0000 (14:16 +0200)] 
qemuSnapshotDiskPrepareOne: Use data from qemuSnapshotDiskContext

Remove all the arguments which are present in qemuSnapshotDiskContext.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuSnapshotDiskContext: Store virQEMUDriverConfig in the struct
Peter Krempa [Wed, 28 Apr 2021 12:12:39 +0000 (14:12 +0200)] 
qemuSnapshotDiskContext: Store virQEMUDriverConfig in the struct

The config is used both with the preparation and execution functions, so
we can store it in the context to simplify other helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuSnapshotDiskPrepareOne: Pass in qemuSnapshotDiskContext
Peter Krempa [Wed, 28 Apr 2021 11:57:57 +0000 (13:57 +0200)] 
qemuSnapshotDiskPrepareOne: Pass in qemuSnapshotDiskContext

Rather than filling various parts of the context from arguments pass in
the whole context.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: process: Setup transient disks only when starting a fresh VM
Peter Krempa [Wed, 28 Apr 2021 09:03:19 +0000 (11:03 +0200)] 
qemu: process: Setup transient disks only when starting a fresh VM

Creating the overlay for the disk is needed when starting a new VM only.
Additionally for now migration with transient disks is forbidden
anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: snapshot: Extract setup of snapshot disk definition for transient disks
Peter Krempa [Wed, 28 Apr 2021 08:17:18 +0000 (10:17 +0200)] 
qemu: snapshot: Extract setup of snapshot disk definition for transient disks

The code will be later reused when adding support for sharing the
backing image of the snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoRemove static analysis assertions
Peter Krempa [Wed, 19 May 2021 14:58:29 +0000 (16:58 +0200)] 
Remove static analysis assertions

None of them are currently needed to pass our upstream CI, most were
either for ancient clang versions or coverity for silencing false
positives.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoDrop magic comments for coverity
Peter Krempa [Wed, 19 May 2021 14:45:11 +0000 (16:45 +0200)] 
Drop magic comments for coverity

They were added mostly randomly and we don't really want to keep working
around of false positives.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: Allow '0' offset for a <slice> of <disk>
Peter Krempa [Fri, 21 May 2021 12:53:43 +0000 (14:53 +0200)] 
schema: Allow '0' offset for a <slice> of <disk>

Using slice to cut off the end of the image is a perfectly vaid
configuration. Use 'unsignedInt' instead of 'positiveInteger' for the
'offset' attribute in the XML schema and modify one test case to cover
this use case.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1960993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: Deduplicate NUMA distance code
Michal Privoznik [Mon, 3 May 2021 09:04:45 +0000 (11:04 +0200)] 
conf: Deduplicate NUMA distance code

After previous patches we have two structures:
virCapsHostNUMACellDistance and virNumaDistance which express the
same thing. And have the exact same members (modulo their names).
Drop the former in favor of the latter.

This change means that distances with value of 0 are no longer
printed out into capabilities XML, because domain XML code allows
partial distance specification and thus threats value of 0 as
unspecified by user (see virDomainNumaGetNodeDistance() which
returns the default LOCAL/REMOTE distance for value of 0).

Also, from ACPI 6.1 specification, section 5.2.17 System Locality
Distance Information Table (SLIT):

  Distance values of 0-9 are reserved and have no meaning.

Thus we shouldn't be ever reporting 0 in neither domain nor
capabilities XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonuma_conf: Expose virNumaDistance formatter
Michal Privoznik [Fri, 14 May 2021 13:25:47 +0000 (15:25 +0200)] 
numa_conf: Expose virNumaDistance formatter

Expose virNumaDistance XML formatter so that it can be re-used by
other parts of the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonuma_conf: Rename virDomainNumaDistance to virNumaDistance
Michal Privoznik [Mon, 17 May 2021 07:15:24 +0000 (09:15 +0200)] 
numa_conf: Rename virDomainNumaDistance to virNumaDistance

There's nothing domain specific about NUMA distances. Rename the
virDomainNumaDistance structure to just virNumaDistance.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agocapabilities: Rename siblings to distances
Michal Privoznik [Mon, 3 May 2021 10:06:42 +0000 (12:06 +0200)] 
capabilities: Rename siblings to distances

The virCapsHostNUMACellSiblingInfo structure really represents
distance to other NUMA node. Rename the structure and variables
of that type to make it more obvious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoRevert "qemuDomainSetNumaParamsLive: set nodeset for root cgroup"
Pavel Hrdina [Fri, 21 May 2021 13:26:59 +0000 (15:26 +0200)] 
Revert "qemuDomainSetNumaParamsLive: set nodeset for root cgroup"

This reverts commit <1b22dd6dd44202094e0f78f887cbe790c00e9ebc>.

First of all, the reverted commit is incomplete. It only sets
cpuset.mems in the VM root cgroup when the API is used but there is no
code that would do the same when the VM is started.

Libvirt never places any process into the VM root cgroup directly. All
the supporting processes like slirp-helper or dbus-daemon are placed
into the emulator sub-cgroup and all the QEMU threads are distributed
between emulator, vcpu* and iothread* sub-cgroups. The scenario
described in the reverted commit can happen only if someone manually
adds any process there which we should not care about.

If we would like to set the limit in the VM root cgroup we need to
introduce better logic:

    - set both (old and new) numa group in the VM root cgroup
    - change the numa group in all sub-cgroups to new value
    - finally set only the new value in the VM root cgroup

The simplest fix now is to revert the commit.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agokbase: Fix broken link of migration doc
Han Han [Mon, 24 May 2021 10:30:20 +0000 (18:30 +0800)] 
kbase: Fix broken link of migration doc

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agolibxl: remove libxl_domain_build_info_init from libxlMakeDomBuildInfo
Olaf Hering [Thu, 20 May 2021 11:26:20 +0000 (13:26 +0200)] 
libxl: remove libxl_domain_build_info_init from libxlMakeDomBuildInfo

The used libxl_domain_build_info, which is contained in
libxl_domain_config, is owned and already initialized by the caller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agolibxl: remove libxl_domain_create_info_init from libxlMakeDomCreateInfo
Olaf Hering [Thu, 20 May 2021 10:58:35 +0000 (12:58 +0200)] 
libxl: remove libxl_domain_create_info_init from libxlMakeDomCreateInfo

The passed libxl_domain_create_info is owned, and already initialized,
by the caller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agolibxl: adjust handling of libxl_device_disk objects
Olaf Hering [Thu, 20 May 2021 10:17:20 +0000 (12:17 +0200)] 
libxl: adjust handling of libxl_device_disk objects

libxl objects are supposed to be initialized and disposed.
Correct the usage of libxl_device_disk objects which are allocated on
the stack. Initialize each one prior usage, and dispose them once done.

Adjust libxlMakeDisk to use an already initialized object, it is owned
by the caller.

Adjust libxlMakeDiskList to initialize the list of objects, before they
are filled by libxlMakeDisk. In case of error, the objects are disposed
by libxl_domain_config_dispose.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agoconf: Report alias name of the detached device in error
Kristina Hanicova [Thu, 20 May 2021 14:13:34 +0000 (16:13 +0200)] 
conf: Report alias name of the detached device in error

This is v2 from:
https://listman.redhat.com/archives/libvir-list/2021-May/msg00481.html

I have reworked the code a bit to have only one error report
instead of multiple ones with different combinations of possible
matching items. Suggested by Laine.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: Return -EINVAL to keep qemuDomainOpenFile() consistent
Kristina Hanicova [Fri, 21 May 2021 11:41:30 +0000 (13:41 +0200)] 
qemu: Return -EINVAL to keep qemuDomainOpenFile() consistent

The description of the function says that the return value is a
file descriptor on success and negative errno on failure which is
not true. If the 'if' case with check on security labels fails,
the return value is -1 not -errno. The solution is to return
'-EINVAL' instead.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Use qemuDomainOpenFile() in qemuPrepareNVRAM()
Kristina Hanicova [Fri, 21 May 2021 11:41:29 +0000 (13:41 +0200)] 
qemu: Use qemuDomainOpenFile() in qemuPrepareNVRAM()

Previously, nvram file was created with user/group owner as
'root', rather than specifications defined in libvirtd.conf. The
solution is to call qemuDomainOpenFile(), which creates file with
defined permissions and qemuSecurityDomainSetPathLabel() to set
security label for created nvram file.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Build command line for object input-linux
Kristina Hanicova [Fri, 21 May 2021 11:01:08 +0000 (13:01 +0200)] 
qemu: Build command line for object input-linux

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/142

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
4 years agoconf: Parse/format XML input type 'evdev'
Kristina Hanicova [Fri, 21 May 2021 11:01:07 +0000 (13:01 +0200)] 
conf: Parse/format XML input type 'evdev'

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_capabilities: Add QEMU_CAPS_INPUT_LINUX
Kristina Hanicova [Fri, 21 May 2021 11:01:06 +0000 (13:01 +0200)] 
qemu_capabilities: Add QEMU_CAPS_INPUT_LINUX

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agostorage_file: add support to probe cluster_size from QCOW2 images
Pavel Hrdina [Wed, 12 May 2021 15:44:19 +0000 (17:44 +0200)] 
storage_file: add support to probe cluster_size from QCOW2 images

From QEMU docs/interop/qcow2.txt :

   Byte  20 - 23:   cluster_bits
                    Number of bits that are used for addressing an offset
                    within a cluster (1 << cluster_bits is the cluster size).

With this patch libvirt will be able to report the current cluster_size
for all existing storage volumes managed by storage driver.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>