]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agodocs: Small fixes for daemons.rst
Jim Fehlig [Fri, 4 Jun 2021 21:59:44 +0000 (15:59 -0600)] 
docs: Small fixes for daemons.rst

Remove some dupicate text and replace in incorrect occurance of
monolithic with modular.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoTranslated using Weblate (Korean)
simmon [Mon, 7 Jun 2021 08:46:26 +0000 (10:46 +0200)] 
Translated using Weblate (Korean)

Currently translated at 44.2% (4563 of 10314 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 7 Jun 2021 08:46:25 +0000 (10:46 +0200)] 
Translated using Weblate (Swedish)

Currently translated at 27.6% (2855 of 10314 strings)

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

Translated using Weblate (Swedish)

Currently translated at 27.1% (2796 of 10314 strings)

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

Translated using Weblate (Swedish)

Currently translated at 26.9% (2777 of 10314 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 agoremoteGetUNIXSocket: Complete variable rename for WIN32
Michal Privoznik [Sat, 5 Jun 2021 04:46:48 +0000 (06:46 +0200)] 
remoteGetUNIXSocket: Complete variable rename for WIN32

In fcdcf8f70cf the remoteGetUNIXSocket() function was changed and
one new variable was introduced (among other things): @env_name.
However, for WIN32 case the variable changed name to @env_path
which builds mingw builds.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirnetsocket: Mark @spawnDaemonPath of virNetSocketNewConnectUNIX() unused
Michal Privoznik [Sat, 5 Jun 2021 04:38:32 +0000 (06:38 +0200)] 
virnetsocket: Mark @spawnDaemonPath of virNetSocketNewConnectUNIX() unused

The virNetSocketNewConnectUNIX() function was changed in
48f66cfe3e. And its WIN32 version (which just reports an error)
was updated too, but this new argument @spawnDaemonPath was not
marked as unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodoRemoteOpen: Drop @daemonPath
Michal Privoznik [Sat, 5 Jun 2021 04:05:27 +0000 (06:05 +0200)] 
doRemoteOpen: Drop @daemonPath

The @daemonPath variable in doRemoteOpen() is no longer used
after faf8354674. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoch: set shared drivers
Wei Liu [Fri, 4 Jun 2021 14:50:52 +0000 (14:50 +0000)] 
ch: set shared drivers

We want to use those shared drivers provided by libvirt to avoid
implementing our own.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Wei Liu <liuwe@microsoft.com>
4 years agochExtractVersion: Drop @ret
Michal Privoznik [Fri, 4 Jun 2021 13:08:32 +0000 (15:08 +0200)] 
chExtractVersion: Drop @ret

After previous patches, the @ret variable and the 'cleanup'
label are redundant. Remove them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agochExtractVersion: use g_auto*
Michal Privoznik [Fri, 4 Jun 2021 13:06:34 +0000 (15:06 +0200)] 
chExtractVersion: use g_auto*

There are two variables that can be freed automatically: @cmd
(which allows us to drop explicit virCommandFree() call at the
end of the function) and @help which was never freed (and thus
leaked).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_driver: Don't error out if CH_CMD was not found
Michal Privoznik [Fri, 4 Jun 2021 12:55:04 +0000 (14:55 +0200)] 
ch_driver: Don't error out if CH_CMD was not found

The CH driver needs "cloud-hypervisor" binary. And if none was
found then the initialization of the driver fails as
chStateInitialize() returns VIR_DRV_STATE_INIT_ERROR. This in
turn means that whole daemon fails to initialize. Let's return
VIR_DRV_STATE_INIT_SKIPPED in this particular case, which
disables the CH drvier but lets the daemon run.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()
Michal Privoznik [Fri, 4 Jun 2021 12:21:40 +0000 (14:21 +0200)] 
ch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()

After previous patches, there's not much value in
chExtractVersion(). Rename chExtractVersionInfo() to
chExtractVersion() and have it use virCHDriver directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agochExtractVersionInfo: Don't check for retversion != NULL
Michal Privoznik [Fri, 4 Jun 2021 12:19:15 +0000 (14:19 +0200)] 
chExtractVersionInfo: Don't check for retversion != NULL

The only caller, chExtractVersion() passes not NULL. Therefore,
it's redundant to check for NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoch_conf: Move error reporting into chExtractVersionInfo()
Michal Privoznik [Fri, 4 Jun 2021 12:18:50 +0000 (14:18 +0200)] 
ch_conf: Move error reporting into chExtractVersionInfo()

If chExtractVersionInfo() fails, in some cases it reports error
and in some it doesn't. Fix those places and drop reporting error
from chExtractVersion() which would just overwrite more specific
error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: add missing docs for some sound devices
Daniel P. Berrangé [Thu, 3 Jun 2021 11:43:30 +0000 (12:43 +0100)] 
docs: add missing docs for some sound devices

Closes: https://gitlab.com/libvirt/libvirt/-/issues/173
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: tweak heading name for <audio> element
Daniel P. Berrangé [Thu, 3 Jun 2021 11:36:51 +0000 (12:36 +0100)] 
docs: tweak heading name for <audio> element

The <audio> element is configuring exclusively a backend, not a device.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: wire up support for timer period audio setting
Daniel P. Berrangé [Thu, 3 Jun 2021 08:15:36 +0000 (09:15 +0100)] 
qemu: wire up support for timer period audio setting

Closes: https://gitlab.com/libvirt/libvirt/-/issues/171
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add support for timer period audio setting
Daniel P. Berrangé [Thu, 3 Jun 2021 08:15:19 +0000 (09:15 +0100)] 
conf: add support for timer period audio setting

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: use virtproxyd if no URI is given
Daniel P. Berrangé [Mon, 24 May 2021 11:23:12 +0000 (12:23 +0100)] 
remote: use virtproxyd if no URI is given

When the default driver mode requests the modular daemons, we still
defaulted to spawning libvirtd if the URI was NULL, because we don't
know which driver specific daemon to spawn. virtproxyd has logic
that can handle this as it is used for compatibility when accepting
incoming TCP connections with a NULL URI.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: remove "spawnDaemon" parameter
Daniel P. Berrangé [Mon, 24 May 2021 14:07:19 +0000 (15:07 +0100)] 
rpc: remove "spawnDaemon" parameter

The "spawnDaemon" and "binary" parameters are co-dependant, with the
latter non-NULL, if-and-only-if the former is true. Getting rid of the
"spawnDaemon" parameter simplifies life for the callers and eliminates
an error checking scenario.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: don't populate daemon path if autostart is not required
Daniel P. Berrangé [Mon, 24 May 2021 13:58:12 +0000 (14:58 +0100)] 
remote: don't populate daemon path if autostart is not required

When deciding what socket to connect to, we build the daemon path
that we need to autostart. This path only needs to be populated
if we actually intend to use autostart.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: change socket helper to return full daemon path
Daniel P. Berrangé [Mon, 24 May 2021 13:08:44 +0000 (14:08 +0100)] 
remote: change socket helper to return full daemon path

The remoteGetUNIXSocket method currently just returns the daemon name
and the caller then converts this to a path. Except the SSH helper
didn't do this, so it was relying on later code expanding $PATH, and
this doesn't allow for build root overrides.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: consistently use flags for passing ro/user/autostart props
Daniel P. Berrangé [Mon, 24 May 2021 13:02:07 +0000 (14:02 +0100)] 
remote: consistently use flags for passing ro/user/autostart props

We have helper methods that return boolans for ro/user/autostart
properties. We then pack them into a flags parameter, and later
unpack them again. This makes the code consistently use flags
throughout.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: move open flags enum to sockets header
Daniel P. Berrangé [Mon, 24 May 2021 12:53:26 +0000 (13:53 +0100)] 
remote: move open flags enum to sockets header

This enum will shortly be used by the remote driver sockets helper
methods too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirfile: Use g_build_filename() when building paths
Luke Yue [Mon, 31 May 2021 01:48:22 +0000 (09:48 +0800)] 
virfile: Use g_build_filename() when building paths

The g_build_filename() would decide which separator
to use instead of hardcoding in g_strdup_printf().

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoAdd basic driver for the Cloud-Hypervisor
William Douglas [Wed, 12 May 2021 17:01:31 +0000 (10:01 -0700)] 
Add basic driver for the Cloud-Hypervisor

Cloud-Hypervisor is a KVM virtualization using hypervisor. It
functions similarly to qemu and the libvirt Cloud-Hypervisor driver
uses a very similar structure to the libvirt driver.

The biggest difference from the libvirt perspective is that the
"monitor" socket is seperated into two sockets one that commands are
issued to and one that events are notified from. The current
implementation only uses the command socket (running over a REST API
with json encoded data) with future changes to add support for the
event socket (to better handle shutdowns from inside the VM).

This patch adds support for the following initial VM actions using the
Cloud-Hypervsior API:
 * vm.create
 * vm.delete
 * vm.boot
 * vm.shutdown
 * vm.reboot
 * vm.pause
 * vm.resume

To use the Cloud-Hypervisor driver, the v15.0 release of
Cloud-Hypervisor is required to be installed.

Some additional notes:
 * The curl handle is persistent but not useful to detect ch process
 shutdown/crash (a future patch will address this shortcoming)
 * On a 64-bit host Cloud-Hypervisor needs to support PVH and so can
 emulate 32-bit mode but it isn't fully tested (a 64-bit kernel and
 32-bit userspace is fine, a 32-bit kernel isn't validated)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
4 years agotests: Update expected output of virsh-optparse
Michal Privoznik [Wed, 2 Jun 2021 14:14:57 +0000 (16:14 +0200)] 
tests: Update expected output of virsh-optparse

In the previous commit I've changed what API is called from
'virsh setmem' command. However, since virsh-optparse test is ran
only when expensive tests are enabled I've completely missed that
the expected output for virsh-optparse test must be updated too
as it contains the API.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh-domain: Drop support for old APIs in cmdSetmem and cmdSetmaxmem
Michal Privoznik [Wed, 19 May 2021 09:58:27 +0000 (11:58 +0200)] 
virsh-domain: Drop support for old APIs in cmdSetmem and cmdSetmaxmem

Some of our really old APIs are missing @flags argument. We
introduced their variants with "Flags" suffix and wired some
logic into virsh to call the new variant only if necessary. This
enables virsh to talk to older daemon which may be lacking new
APIs.

However, in case of cmdSetmem() we are talking about v0.1.1
(virDomainSetMemory()) vs. v0.9.0 (virDomainSetMemoryFlags()) and
in case of cmdSetmaxmem() we are talking about v0.0.3
(virDomainSetMaxMemory()) vs v0.9.0 (virDomainSetMemoryFlags()).

Libvirt v0.9.0 was released more than 10 years ago and recently
we dropped support for RHEL-7 which has v4.5.0 (released ~3 years
ago). Thus it is not really necessary to have support in virsh
for such old daemons.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonode_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage()
Michal Privoznik [Mon, 31 May 2021 14:42:13 +0000 (16:42 +0200)] 
node_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage()

When processing node devices, the udevProcessStorage() will be
called if the device is some form of storage. In here, ID_TYPE
attribute is queried and depending on its value one of more
specialized helper functions is called. For instance, for
ID_TYPE=="cd" the udevProcessCDROM() is called, for
ID_TYPE=="disk" the udevProcessDisk() is called, and so on.

But there's a problem with ID_TYPE and its values. Coming from
udev, we are not guaranteed that ID_TYPE will contain "cd" for
CDROM devices. In fact, there's a rule installed by sg3_utils
that will overwrite ID_TYPE to "cd/dvd" leaving us with an
unhandled type. Fortunately, this was fixed in their upstream,
but there are still versions out there, on OS platforms that we
aim to support that contain the problematic rule. Therefore, we
should accept both strings.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1848875
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonode_device_udev: Don't overwrite @ret in udevProcessStorage()
Michal Privoznik [Mon, 31 May 2021 14:22:42 +0000 (16:22 +0200)] 
node_device_udev: Don't overwrite @ret in udevProcessStorage()

Let's use a different variable for storing retvals of helper
functions. This way the usual function pattern can be restored.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonode_device_udev: Make udevGetStringProperty() return void
Michal Privoznik [Mon, 31 May 2021 14:24:18 +0000 (16:24 +0200)] 
node_device_udev: Make udevGetStringProperty() return void

This function can't fail really as it's returning 0 no matter
what. This is probably a residue from old days when we cared
about propagating OOM errors. Now we just abort. Make its return
type void then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agonode_device_udev: Make udevGenerateDeviceName() return void
Michal Privoznik [Mon, 31 May 2021 14:19:12 +0000 (16:19 +0200)] 
node_device_udev: Make udevGenerateDeviceName() return void

This function can't fail really as it's returning 0 no matter
what. This is probably a residue from old days when we cared
about propagating OOM errors. Now we just abort. Make its return
type void then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agolibxl: adjust handling of libxl_device_nic objects
Jim Fehlig [Wed, 26 May 2021 20:05:05 +0000 (14:05 -0600)] 
libxl: adjust handling of libxl_device_nic objects

libxl objects are supposed to be initialized and disposed. Adjust
libxlMakeNic to use an already initialized object owned by the caller.

Adjust libxlMakeNicList to initialize the list of objects, before they
are filled by libxlMakeNic. The libxl_domain_config object passed to
libxlMakeNicList is owned by the caller and will be disposed with
libxl_domain_config_dispose, which also disposes embedded objects such
as libxl_device_nic.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Olaf Hering <olaf@aepfle.de>
4 years agovirDomainDiskDefParseSource: parse source bits from driver element
Pavel Hrdina [Thu, 27 May 2021 13:32:17 +0000 (15:32 +0200)] 
virDomainDiskDefParseSource: parse source bits from driver element

Before the mentioned commit we always parsed the whole disk definition
for qemuDomainBlockCopy API but we only used the @src part. Based on
that assumption the code was changed to parse only the disk <source>
element.

Unfortunately that is not correct as we need to parse some parts of
<driver> element as well.

Fixes: 0202467c4ba8663db2304b140af609f93a9b3091
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodomain_conf: extract disk driver source bits to its own function
Pavel Hrdina [Thu, 27 May 2021 13:25:51 +0000 (15:25 +0200)] 
domain_conf: extract disk driver source bits to its own function

Attribute `type` and sub-element `metadata_cache` are internally stored
in the `virStorageSource` structure. Sometimes we only care about the
disk source bits so we need a dedicated helper for that.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agomeson: Style tweaks
Andrea Bolognani [Wed, 26 May 2021 15:47:58 +0000 (17:47 +0200)] 
meson: Style tweaks

These checks look different than most similar ones for no
particular reason.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Switch to autodetection for driver_test
Andrea Bolognani [Wed, 26 May 2021 15:46:26 +0000 (17:46 +0200)] 
meson: Switch to autodetection for driver_test

Match the behavior of most other features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Switch to autodetection for driver_remote
Andrea Bolognani [Wed, 26 May 2021 14:06:40 +0000 (16:06 +0200)] 
meson: Switch to autodetection for driver_remote

Match the behavior of most other features.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Switch to autodetection for apparmor_profiles
Andrea Bolognani [Thu, 27 May 2021 13:20:43 +0000 (15:20 +0200)] 
meson: Switch to autodetection for apparmor_profiles

Match the behavior of most other features.

This will result in a change in behavior, because profiles will
now be installed whenever AppArmor support is enabled; on the
other hand, this is probably the behavior users expected in the
first place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Turn apparmor_profiles into a feature
Andrea Bolognani [Thu, 27 May 2021 13:20:24 +0000 (15:20 +0200)] 
meson: Turn apparmor_profiles into a feature

Similar knobs, such as firewalld_zone and sysctl_config, are
already features, so convert this one as well to comply with
expectations.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Rewrite apparmor_profiles check
Andrea Bolognani [Thu, 27 May 2021 13:17:19 +0000 (15:17 +0200)] 
meson: Rewrite apparmor_profiles check

Attempting to enable apparmor_profiles when apparmor support
is not enabled should result in an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
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>