]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agocpu-data.py: Query hyperv enlightenments
Tim Wiederhake [Tue, 25 Jan 2022 11:18:23 +0000 (12:18 +0100)]
cpu-data.py: Query hyperv enlightenments

Reporting hv-* properties properly requires hv to be enabled,
see qemu commit 071ce4b03b.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoinclude: Fix documentation for various VIR_*_LAST values
Andrea Bolognani [Thu, 27 Jan 2022 14:26:57 +0000 (15:26 +0100)]
include: Fix documentation for various VIR_*_LAST values

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainDetachDeviceLive: Handle hostevs with unassigned type of address
Michal Privoznik [Tue, 25 Jan 2022 10:05:21 +0000 (11:05 +0100)]
qemuDomainDetachDeviceLive: Handle hostevs with unassigned type of address

A <hostdev/> can have <address type='unassigned'/> which means
libvirt manages the device detach from/reattach to the host but
the device is never exposed to the guest. This means that we have
to take a shortcut during hotunplug (e.g. never ask QEMU on the
monitor to detach the device, or never wait for DEVICE_DELETED
event).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainAttachHostPCIDevice: Handle hostevs with unassigned type of address
Michal Privoznik [Tue, 25 Jan 2022 07:51:26 +0000 (08:51 +0100)]
qemuDomainAttachHostPCIDevice: Handle hostevs with unassigned type of address

A <hostdev/> can have <address type='unassigned'/> which means
libvirt manages the device detach from/reattach to the host but
the device is never exposed to the guest. This means that we have
to take a shortcut during hotplug, similar to the one we are
taking when constructing the command line (see
qemuBuildHostdevCommandLine()).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2040548
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodomain_validate: Refuse VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED
Michal Privoznik [Tue, 25 Jan 2022 09:47:28 +0000 (10:47 +0100)]
domain_validate: Refuse VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED

We document that <address type='unassigned'/> can be used only
for <hostdev/>-s. However, corresponding validation rule is
missing. Let's put the rule into hypervisor agnostic part of
validation process so that all drivers can benefit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agomeson: Optimize handling of qemu_user and qemu_group
Andrea Bolognani [Wed, 26 Jan 2022 14:21:20 +0000 (15:21 +0100)]
meson: Optimize handling of qemu_user and qemu_group

If the user has already provided us with the configuration they
want, there's no point in trying to come up with a reasonable
OS-specific default.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agomeson: Require that both qemu_user and qemu_group are provided
Andrea Bolognani [Wed, 26 Jan 2022 14:14:13 +0000 (15:14 +0100)]
meson: Require that both qemu_user and qemu_group are provided

Or that neither is. The current implementation, where if only
one of the two is provided the other one will be based on
OS-specific defaults is more likely to cause confusion than it
is to be helpful.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agomeson: Don't check whether qemu_user and qemu_group exist
Andrea Bolognani [Wed, 26 Jan 2022 14:11:17 +0000 (15:11 +0100)]
meson: Don't check whether qemu_user and qemu_group exist

QEMU might not be installed on the build system, in which case
the user and group will not be present. We should avoid falling
back to root:root in that case, and assume the user and group
are going to be present in the target system instead.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agomeson: Don't require /etc/os-release to be present
Andrea Bolognani [Wed, 26 Jan 2022 14:01:40 +0000 (15:01 +0100)]
meson: Don't require /etc/os-release to be present

It might be part of some non-mandatory package on certain
distros, and our logic deals just fine with its contents not
being available.

Fixes: 4c69d64efa3731d074d198f871fd42e74c4a39f6
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agonode_device: Treat NVMe disks as regular disks
Michal Privoznik [Wed, 26 Jan 2022 12:47:33 +0000 (13:47 +0100)]
node_device: Treat NVMe disks as regular disks

Unfortunately, udev doesn't set ID_TYPE attribute for NVMe disks,
therefore we have to add another case into udevKludgeStorageType()
to treat /dev/nvme* devlinks as any other disk.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045953
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agonode_device: Rework udevKludgeStorageType()
Michal Privoznik [Wed, 26 Jan 2022 13:00:13 +0000 (14:00 +0100)]
node_device: Rework udevKludgeStorageType()

The udevKludgeStorageType() function looks at devlink name
(/dev/XXX) and guesses the type of the (storage) device using a
series of STRPREFIX() calls. Well those can be turn into an array
and a for() loop, especially if we are about to add a new case
(in the next commit).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Allow prealloc for virtio-mem-pci
Michal Privoznik [Tue, 30 Nov 2021 17:16:00 +0000 (18:16 +0100)]
qemu: Allow prealloc for virtio-mem-pci

There are a some scenarios in which we want to prealloc guest
memory (e.g. when requested in domain XML, when using hugepages,
etc.). With 'regular' <memory/> models (like 'dimm', 'nvdimm' or
'virtio-pmem') or regular guest memory it is corresponding
memory-backend-* object that ends up with .prealloc attribute
set. And that's desired because neither of those devices can
change its size on the fly. However, with virtio-mem model things
are a bit different. While one can set .prealloc attribute on
corresponding memory-backend-* object it doesn't make much sense,
because virtio-mem can inflate/deflate on the fly, i.e. change
how big of a portion of the memory-backend-* object is exposed to
the guest. For instance, from a say 4GiB module only a half can
be exposed to the guest. Therefore, it doesn't make much sense to
preallocate whole 4GiB and keep them allocated. But we still want
the part exposed to the guest preallocated (when conditions
described at the beginning are met).

Having said that, with new enough QEMU the virtio-mem-pci device
gained new attribute ".prealloc" which instructs the device to
talk to the memory backend object and allocate only the requested
portion of memory.

Now, that our algorithm for setting .prealloc was isolated in a
single function, the function can be called when constructing cmd
line for virtio-mem-pci device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC
Michal Privoznik [Tue, 30 Nov 2021 16:52:28 +0000 (17:52 +0100)]
qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC

This new capability tracks whether virtio-mem device is capable
of memory preallocation, which is detected by the device having
.prealloc attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Move @prealloc into qemuBuildMemoryGetPagesize()
Michal Privoznik [Wed, 1 Dec 2021 11:34:09 +0000 (12:34 +0100)]
qemu: Move @prealloc into qemuBuildMemoryGetPagesize()

The qemuBuildMemoryGetPagesize() function has everything is needs
to decide whether preallocation is needed or not. Move the logic
from qemuBuildMemoryBackendProps() into
qemuBuildMemoryGetPagesize().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Separate out hugepages handling from qemuBuildMemoryBackendProps()
Michal Privoznik [Wed, 1 Dec 2021 09:44:32 +0000 (10:44 +0100)]
qemu: Separate out hugepages handling from qemuBuildMemoryBackendProps()

The qemuBuildMemoryBackendProps() function is already long
enough. Move code that decides what hugepages to use into a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildMemoryDeviceProps: Fix const correctness
Michal Privoznik [Wed, 1 Dec 2021 12:23:04 +0000 (13:23 +0100)]
qemuBuildMemoryDeviceProps: Fix const correctness

The @mem agrument of qemuBuildMemoryDeviceProps() function is
only read from. Make this fact obvious from the function
declaration too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agospec: Don't clean up *.la and *.a files
Andrea Bolognani [Mon, 24 Jan 2022 16:10:57 +0000 (17:10 +0100)]
spec: Don't clean up *.la and *.a files

autotools used to produce those, but meson doesn't.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoconf: Separate out virDomainClockDef formatting
Michal Privoznik [Mon, 24 Jan 2022 06:15:04 +0000 (07:15 +0100)]
conf: Separate out virDomainClockDef formatting

Currently, virDomainClockDef is formatted inside
virDomainDefFormatInternalSetRootName() which is already long
enough. Move the code into a new function
(virDomainClockDefFormat()) and make the code use
virXMLFormatElement() while at it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainTimerDefFormat: return void
Michal Privoznik [Mon, 24 Jan 2022 06:04:48 +0000 (07:04 +0100)]
virDomainTimerDefFormat: return void

This function never returns an error, make it void then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Rework virDomainTimerDefFormat()
Michal Privoznik [Mon, 24 Jan 2022 05:41:09 +0000 (06:41 +0100)]
conf: Rework virDomainTimerDefFormat()

Use virXMLFormatElement() to simplify virDomainTimerDefFormat().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Fix @mode member of _virDomainTimerDef struct
Michal Privoznik [Sun, 23 Jan 2022 21:08:03 +0000 (22:08 +0100)]
conf: Fix @mode member of _virDomainTimerDef struct

The @mode member of the _virDomainTimerDef struct stores
values of the virDomainTimerModeType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Fix @track member of _virDomainTimerDef struct
Michal Privoznik [Sun, 23 Jan 2022 20:56:54 +0000 (21:56 +0100)]
conf: Fix @track member of _virDomainTimerDef struct

The @track member of the _virDomainTimerDef struct stores
values of the virDomainTimerTrackType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Fix @tickpolicy member of _virDomainTimerDef struct
Michal Privoznik [Sun, 23 Jan 2022 20:34:29 +0000 (21:34 +0100)]
conf: Fix @tickpolicy member of _virDomainTimerDef struct

The @tickpolicy member of the _virDomainTimerDef struct stores
values of the virDomainTimerTickpolicyType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Fix type of @present in _virDomainTimerDef struct
Michal Privoznik [Sun, 23 Jan 2022 20:15:10 +0000 (21:15 +0100)]
conf: Fix type of @present in _virDomainTimerDef struct

In the _virDomainTimerDef structure we have @present member which
is like virTristateBool, except it's an integer and has values
shifted by one. This is harder to read. Retype the member to
virTristateBool which we are familiar with.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainChrSourceDefCopy: return void
Michal Privoznik [Mon, 24 Jan 2022 07:58:00 +0000 (08:58 +0100)]
virDomainChrSourceDefCopy: return void

This function never returns an error, make it void then. And
while at it, make the @src argument const to make it obvious it's
never changed inside the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainChrSourceDefCopy: Don't check arguments against NULL
Michal Privoznik [Mon, 24 Jan 2022 07:55:52 +0000 (08:55 +0100)]
virDomainChrSourceDefCopy: Don't check arguments against NULL

The only caller of this function
(qemuProcessFindCharDevicePTYsMonitor()) doesn't pass NULL.
Remove corresponding check from virDomainChrSourceDefCopy().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainChrSourceDefCopy: Copy more struct members
Michal Privoznik [Sun, 23 Jan 2022 13:58:36 +0000 (14:58 +0100)]
virDomainChrSourceDefCopy: Copy more struct members

The aim of virDomainChrSourceDefCopy() is to make a deep copy of
given virDomainChrSourceDef. However, some types were not copied
at all (VIR_DOMAIN_CHR_TYPE_SPICEVMC and
VIR_DOMAIN_CHR_TYPE_SPICEPORT) and some members weren't copied
either (@logfile, @logappend).

After this, there are still some members that are not copied
(seclabels and private data), but the sole caller
qemuProcessFindCharDevicePTYsMonitor() doesn't seem to care.
Therefore, just document this behavior so that future user is
aware.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainInputDefParseXML: Move validation into validator
Michal Privoznik [Sun, 23 Jan 2022 11:54:27 +0000 (12:54 +0100)]
virDomainInputDefParseXML: Move validation into validator

There is some code that validates whether parsed @bus <input/>
makes sense (e.g. some hypervisors have their own type of bus).
But this code should not live in the parser, but validator
rather. That way, we can also validate that the value we compute
(if user didn't provide any) is valid.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSetupDisk: Initialize 'targetPaths'
Peter Krempa [Tue, 25 Jan 2022 16:49:00 +0000 (17:49 +0100)]
qemuDomainSetupDisk: Initialize 'targetPaths'

Compiler isn't able to see that 'virDevMapperGetTargets' in cases e.g.
when the devmapper isn't available may not initialize the value in the
pointer passed as the second argument.

The usage 'qemuDomainSetupDisk' lead to an accidental infinite loop as
previous calls apparently doctored the stack to a point where
'g_slist_concat' would end up in an infinite loop trying to find the end
of the list.

Fixes: 6c49c2ee9fcb88de02cdc333f666a8e95d60a3b0
Closes: https://gitlab.com/libvirt/libvirt/-/issues/268
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agomeson: recognize sles when guessing default_qemu_user
Olaf Hering [Tue, 25 Jan 2022 13:17:23 +0000 (14:17 +0100)]
meson: recognize sles when guessing default_qemu_user

NAME="SLES"
VERSION="15-SP3"
VERSION_ID="15.3"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP3"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp3"
DOCUMENTATION_URL="https://documentation.suse.com/"

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agonews: Mention hvf domain type
Roman Bolshakov [Sun, 18 Nov 2018 12:47:37 +0000 (15:47 +0300)]
news: Mention hvf domain type

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: Add support page for libvirt on macOS
Roman Bolshakov [Tue, 20 Nov 2018 00:12:17 +0000 (03:12 +0300)]
docs: Add support page for libvirt on macOS

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: Note hvf support for domain elements
Roman Bolshakov [Mon, 19 Nov 2018 11:13:53 +0000 (14:13 +0300)]
docs: Note hvf support for domain elements

Many domain elements have "QEMU and KVM only" or "QEMU/KVM since x.y.z"
remarks. Most of the elements work for HVF domain, so it makes sense to
add respective notices for HVF domain.

All the elements have been manually tested.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: Add hvf on QEMU driver page
Roman Bolshakov [Sun, 18 Nov 2018 21:27:07 +0000 (00:27 +0300)]
docs: Add hvf on QEMU driver page

It's worth to make the domain type a little bit more visible than a row
in news. An example of hvf domain is available on QEMU driver page.

While at it, mention Hypervisor.framework on index page.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: Add HVF test cases
Andrea Bolognani [Tue, 4 Jan 2022 16:27:01 +0000 (17:27 +0100)]
tests: Add HVF test cases

We need to use a hardcoded list of capabilities because we don't
yet have proper replies files obtained from QEMU running on actual
macOS machines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: Add macOS support to qemuxml2*test
Andrea Bolognani [Thu, 6 Jan 2022 11:32:33 +0000 (12:32 +0100)]
tests: Add macOS support to qemuxml2*test

The new DO_TEST_MACOS() macro makes it possible to create test
cases that verify the behavior of libvirt on a macOS machine
with HVF support available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: Add macOS support to testutilsqemu
Andrea Bolognani [Thu, 6 Jan 2022 10:45:25 +0000 (11:45 +0100)]
tests: Add macOS support to testutilsqemu

This exposes a couple of macOS-specific variants of existing
APIs, which can be used when implementing test programs and
result in HVF support being advertised.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: Introduce testQemuHostOS
Andrea Bolognani [Thu, 6 Jan 2022 11:32:25 +0000 (12:32 +0100)]
tests: Introduce testQemuHostOS

This new enumeration provides a way to specify the host OS
that a specific test case expects. The default is Linux, which
has been the implicit host OS until now; when Linux is selected
as the host OS, KVM support is advertised in capabilies data
exposed to test cases.

This commit doesn't result in any functional change, and simply
sets the stage for introducing macOS host OS support later.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Correct CPU capabilities probing for hvf
Roman Bolshakov [Fri, 19 Oct 2018 18:32:03 +0000 (21:32 +0300)]
qemu: Correct CPU capabilities probing for hvf

With this change virsh domcapabilites shows:

  <mode name='host-passthrough' supported='yes'/>

https://gitlab.com/libvirt/libvirt/-/issues/147

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Introduce virQEMUCapsHaveAccel
Roman Bolshakov [Fri, 19 Oct 2018 15:10:05 +0000 (18:10 +0300)]
qemu: Introduce virQEMUCapsHaveAccel

The function should be used to check if qemu capabilities include a
hardware acceleration, i.e. accel is not TCG.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Introduce virQEMUCapsTypeIsAccelerated
Roman Bolshakov [Fri, 19 Oct 2018 14:30:26 +0000 (17:30 +0300)]
qemu: Introduce virQEMUCapsTypeIsAccelerated

It replaces hardcoded checks for KVM. It'll be cleaner to use
the function once multiple accelerators are supported in the
QEMU driver.

Explicit KVM domain checks should be done only when a feature is
available only for KVM.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Introduce virQEMUCapsAccelStr
Roman Bolshakov [Fri, 19 Oct 2018 16:38:33 +0000 (19:38 +0300)]
qemu: Introduce virQEMUCapsAccelStr

This makes possible to add more accelerators by touching less code and
reduces code duplication.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Expose hvf domain type if hvf is supported
Roman Bolshakov [Fri, 19 Oct 2018 13:08:17 +0000 (16:08 +0300)]
qemu: Expose hvf domain type if hvf is supported

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Query hvf capability on macOS
Roman Bolshakov [Fri, 19 Oct 2018 12:07:53 +0000 (15:07 +0300)]
qemu: Query hvf capability on macOS

There's no QMP command for querying if hvf is supported, therefore we
use sysctl interface that tells if Hypervisor.framework works/available
on the host.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Define hvf capability
Roman Bolshakov [Fri, 19 Oct 2018 12:06:26 +0000 (15:06 +0300)]
qemu: Define hvf capability

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoconf: Add hvf domain type
Roman Bolshakov [Thu, 18 Oct 2018 22:14:01 +0000 (01:14 +0300)]
conf: Add hvf domain type

QEMU supports Hypervisor.framework since 2.12 as hvf accel.
Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).

It's supported since macOS 10.10 on machines with Intel VT-x feature
set that includes Extended Page Tables (EPT) and Unrestricted Mode.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Add KVM CPUs into cache only if KVM is present
Roman Bolshakov [Wed, 21 Nov 2018 18:45:02 +0000 (21:45 +0300)]
qemu: Add KVM CPUs into cache only if KVM is present

virQEMUCapsFormatCache/virQEMUCapsLoadCache adds/reads KVM CPUs to/from
capabilities cache regardless of QEMU_CAPS_KVM. That can cause undesired
side-effects when KVM CPUs are present in the cache on a platform that
doesn't support it, e.g. macOS or Linux without KVM support.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: Only probe KVM on Linux
Andrea Bolognani [Wed, 5 Jan 2022 15:37:51 +0000 (16:37 +0100)]
qemu: Only probe KVM on Linux

We already know it's not going to be available on other
platforms.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agolibxl: Add lock process indicator to saved VM state
Jim Fehlig [Mon, 24 Jan 2022 19:03:20 +0000 (12:03 -0700)]
libxl: Add lock process indicator to saved VM state

Commit fa58f571ee added a lock processes indicator to the
libxlDomainObjPrivate struct to note that a lock process was
successfully started for the VM. However, the commit neglected to
add the indicator to the VM's saved state file. As a result, the
indicator is lost on libvirtd restart, along with the knowledge of
whether a lock process was started for the VM.

This change adds support for the indicator in the domainObjPrivate
data parse and format callbacks, ensuring its value survives libvirtd
restarts.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: network: Allow hostnames to start with a number
Nicolas Lécureuil [Fri, 14 Jan 2022 11:02:08 +0000 (12:02 +0100)]
conf: network: Allow hostnames to start with a number

RFC952 mandated that hostnames would start with an alpha character.
This requirement was later relaxed by RFC1123 which allowed hostnames to
start with a number as well.

https://datatracker.ietf.org/doc/html/rfc952
https://datatracker.ietf.org/doc/html/rfc1123#page-13

Signed-off-by: Nicolas Lécureuil <nicolas.lecureuil@siveo.net>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemuDomainAttachHostPCIDevice: Fix coding style
Michal Privoznik [Tue, 25 Jan 2022 09:48:36 +0000 (10:48 +0100)]
qemuDomainAttachHostPCIDevice: Fix coding style

Our coding style requires that a body of an if() longer than two
lines is wrapped in a curly braces. There's one offender in
qemuDomainAttachHostPCIDevice(). Fortunately, there was no
functional problem because one of the lines is a comment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Mention the types of params in event callbacks
Han Han [Wed, 19 Jan 2022 04:19:36 +0000 (12:19 +0800)]
docs: Mention the types of params in event callbacks

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agodocs: Fix typos in the code comment
Han Han [Wed, 19 Jan 2022 04:19:35 +0000 (12:19 +0800)]
docs: Fix typos in the code comment

1. s/LifeCycle/Lifecycle/
2. s/virConnectDomainEventTrayChangeReason/virDomainEventTrayChangeReason/

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 23 Jan 2022 20:16:39 +0000 (21:16 +0100)]
Translated using Weblate (Swedish)

Currently translated at 31.9% (3336 of 10455 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>
3 years agoqemu: Remove scsi parameter for vhost-user-blk for qemu < 4.2
shenjiatong [Sat, 22 Jan 2022 04:10:35 +0000 (12:10 +0800)]
qemu: Remove scsi parameter for vhost-user-blk for qemu < 4.2

When trying to attach vhost-user-blk device to virtual machine using
qemu < 4.2 libvirt would mistakenly add a scsi=off parameter, which is
not supported by qemu.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/265
Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemuxml2argvtest: disk-vhostuser: Add invocation for qemu-4.2
Peter Krempa [Thu, 13 Jan 2022 11:47:17 +0000 (12:47 +0100)]
qemuxml2argvtest: disk-vhostuser: Add invocation for qemu-4.2

With qemu versions prior to qemu-5.0 we'll format 'scsi=off' for
virtio-blk disks, but also for vhost-user-blk. This is a bug as it's not
supported.

Add a test case to show that wrong configuration is generated by adding
running 'disk-vhostuser' test case on capabilities from qemu-4.2.

For this to be possible it's required to enable shared memory via NUMA
configuration as old QEMU's don't allow configuration of the default
memory backend. This is achieved by adding a copy of the
'disk-vhostuser' XML with NUMA enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 years agomeson: Explicitly specify run_command's check parameter
Martin Kletzander [Sat, 22 Jan 2022 19:30:11 +0000 (20:30 +0100)]
meson: Explicitly specify run_command's check parameter

An update to meson 0.61.1 meant that it started showing warnings due to the fact
that the default for run_command's 'check' parameter is going to change.  It
unveiled the fact that we were even missing that parameter in some calls where
we expected different outcome.  To make sure the behaviour does not change
specify the parameter explicitly.  In places where we check for the return code
the parameter should be 'false' so that meson does not fail.  In all other cases
the parameter should be set to 'true' to make sure possible failure also stops
meson.

The warning in meson was added in https://github.com/mesonbuild/meson/pull/9304

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoesx: Do not return root objects in a lookup
Martin Kletzander [Sat, 22 Jan 2022 19:29:43 +0000 (20:29 +0100)]
esx: Do not return root objects in a lookup

The lookups in esx_vi work a bit differently that we are used to.  The filters
(travelsalSpec and selectSet) choose how to look up the objects, but given a
root object the lookup lists all the objects of a requested type inside it as
well as the root object itself.  We then go through the results and find the one
which has the same name as was requested.  However in a case with nested folders
of a same name this could break when the first returned object in the list is
the parent folder as we'd select it only based on the name.  To avoid this also
add a check that the candidate we are trying to pick is not exactly the same
object (reference) as the root object.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agodocs: Fix spelling
Tim Wiederhake [Mon, 24 Jan 2022 08:41:44 +0000 (09:41 +0100)]
docs: Fix spelling

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
3 years agobhyve: handle all enum values in switches
Ján Tomko [Fri, 21 Jan 2022 17:01:29 +0000 (18:01 +0100)]
bhyve: handle all enum values in switches

Recent commits switched some variables to enums but did not
fix the warnings in the bhyve driver.

Fixes: 0eb42087c7907f43c114cb57b5ff2cf2a52dfea4
Fixes: a1ce98061c9a3f9ced367b2b9a3fe4071930a128
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virDomainHostdevDefParseXMLSubsys() to virXMLProp*()
Michal Privoznik [Thu, 20 Jan 2022 12:58:59 +0000 (13:58 +0100)]
conf: Convert virDomainHostdevDefParseXMLSubsys() to virXMLProp*()

After previous cleanups, the virDomainHostdevDefParseXMLSubsys()
function uses a mixture of virXMLProp*() and the old
virXMLPropString() + virXXXTypeFromString() patterns. Rework it
so that virXMLProp*() is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virNetworkPortDefParseXML() to virXMLProp*()
Michal Privoznik [Fri, 21 Jan 2022 09:19:34 +0000 (10:19 +0100)]
conf: Convert virNetworkPortDefParseXML() to virXMLProp*()

After previous cleanups, the virNetworkPortDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virDomainNetDefParseXML() to virXMLProp*()
Michal Privoznik [Thu, 20 Jan 2022 12:15:03 +0000 (13:15 +0100)]
conf: Convert virDomainNetDefParseXML() to virXMLProp*()

After previous cleanups, the virDomainNetDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virDomainFSDefParseXML() to virXMLProp*()
Michal Privoznik [Thu, 20 Jan 2022 12:14:53 +0000 (13:14 +0100)]
conf: Convert virDomainFSDefParseXML() to virXMLProp*()

After previous cleanups, the virDomainFSDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virDomainDefParseBootXML() to virXMLProp*()
Michal Privoznik [Thu, 20 Jan 2022 20:57:49 +0000 (21:57 +0100)]
conf: Convert virDomainDefParseBootXML() to virXMLProp*()

After previous cleanups, the virDomainDefParseBootXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Convert virCPUDefParseXML() to virXMLProp*()
Michal Privoznik [Thu, 20 Jan 2022 20:57:35 +0000 (21:57 +0100)]
conf: Convert virCPUDefParseXML() to virXMLProp*()

After previous cleanups, the virCPUDefParseXML() function uses a
mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Almost eliminate use of virTristateBoolTypeFromString()
Michal Privoznik [Thu, 20 Jan 2022 12:58:49 +0000 (13:58 +0100)]
lib: Almost eliminate use of virTristateBoolTypeFromString()

There are couple of places where virTristateBoolTypeFromString()
is called. Well, the same result can be achieved by
virXMLPropTristateBool() and on fewer lines.

Note there are couple of places left untouched because those
don't care about error reporting and thus are shorter they way
they are now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Eliminate use of virTristateSwitchTypeFromString()
Michal Privoznik [Thu, 20 Jan 2022 10:24:55 +0000 (11:24 +0100)]
lib: Eliminate use of virTristateSwitchTypeFromString()

There are couple of places (all of them in XML parsing) where
virTristateSwitchTypeFromString() is called. Well, the same
result can be achieved by virXMLPropTristateSwitch() and on fewer
lines.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use virTristateBool instead of virTristateSwitch in a few places
Michal Privoznik [Thu, 20 Jan 2022 13:14:31 +0000 (14:14 +0100)]
qemu: Use virTristateBool instead of virTristateSwitch in a few places

Both @accel2d and @accel3d are parsed as virTristateBool, but in
a few places (qemuDeviceVideoGetModel() and
qemuValidateDomainDeviceDefVideo()) they are compared to
virTristateSwitch enum either directly or via a variable of that
type. Clear this confusion by using the correct enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuValidateDomainDeviceDefFS: Use correct enum for fs->multidevs comparison
Michal Privoznik [Fri, 21 Jan 2022 11:22:07 +0000 (12:22 +0100)]
qemuValidateDomainDeviceDefFS: Use correct enum for fs->multidevs comparison

During validation of a virDomainFSDef QEMU capabilities are check
for multidevs support if the FS definition has it enabled.
However, the fs->multidevs is really type of virDomainFSMultidevs
but is compared against virDomainFSModel enum. Fortunately, both
values are the same so no user visible harm done here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirNetworkPortDefParseXML: Fix a typo in an error message
Michal Privoznik [Thu, 20 Jan 2022 20:46:28 +0000 (21:46 +0100)]
virNetworkPortDefParseXML: Fix a typo in an error message

There's a typo in error message that's printed when parsing of
<plug type=''/> fails: "prt" is reported instead of "port".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirxml: Extend virXMLPropU{Int,LongLong}() error message
Michal Privoznik [Thu, 20 Jan 2022 15:06:26 +0000 (16:06 +0100)]
virxml: Extend virXMLPropU{Int,LongLong}() error message

In case virXMLPropUInt() or virXMLPropULongLong() meets an
attribute with a negative integer the following error message is
printed:

  Invalid value ...: Expected integer value

This message is not as good as it could be. Let users know it's a
non-negative integer we are expecting.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: Fix the qemuBuldDomainLoaderPflashCommandLine name typo
Erik Skultety [Fri, 21 Jan 2022 14:20:22 +0000 (15:20 +0100)]
qemu: command: Fix the qemuBuldDomainLoaderPflashCommandLine name typo

The function should be called qemuBuildDomainLoaderPflashCommandLine.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
3 years agoman: virt-admin: Mention monolithic daemon URIs
Peter Krempa [Thu, 20 Jan 2022 15:20:22 +0000 (16:20 +0100)]
man: virt-admin: Mention monolithic daemon URIs

Hint users that they can use 'virt-admin' also for the new monolithic
daemons.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2038045
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Fix for modular daemons
Peter Krempa [Mon, 17 Jan 2022 15:19:59 +0000 (16:19 +0100)]
kbase: debuglogs: Fix for modular daemons

Modular daemons are now the default in many new installations, thus we
need to include steps how to determine that modular daemons are used and
modular-daemon specific locations for the config files and admin URIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agodocs: daemons: Add section on figuring out whether modular or monolithic daemon is...
Peter Krempa [Mon, 17 Jan 2022 09:24:14 +0000 (10:24 +0100)]
docs: daemons: Add section on figuring out whether modular or monolithic daemon is in use

Since we are at a transition period where some users may be running
monolithic libvirtd and others already the modular topology we need a
section that allows users to figure out which is in use.

This will be particularly important in the document about enabling
logging, as the active log file depends on which daemon is in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agoman: virt-admin: Remove misleading paragraph about unix socket permissions
Peter Krempa [Thu, 20 Jan 2022 17:17:47 +0000 (18:17 +0100)]
man: virt-admin: Remove misleading paragraph about unix socket permissions

The socket permissions are controlled by 'unix_sock_admin_perms', but
regardless the code requires that 'geteuid() != clientuid' to allow
clients thus it doesn't make sense to make users aware of it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: Drop node.gif
Andrea Bolognani [Wed, 19 Jan 2022 16:54:53 +0000 (17:54 +0100)]
docs: Drop node.gif

It's the only GIF file we have in our repository.

We could convert it to PNG, but that would result in a
significantly bigger file (~5.5 KiB vs ~1.5 KiB).

Since the image doesn't really add much to the documentation,
drop it instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: update QEMU capabilities for qemu 6.2 release
Daniel Henrique Barboza [Thu, 20 Jan 2022 17:47:40 +0000 (14:47 -0300)]
tests: update QEMU capabilities for qemu 6.2 release

Update existing ppc64 6.2 caps to match what was released in QEMU 6.2.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoRevert "report error when virProcessGetStatInfo() is unable to parse data"
Michal Privoznik [Tue, 18 Jan 2022 11:40:09 +0000 (12:40 +0100)]
Revert "report error when virProcessGetStatInfo() is unable to parse data"

This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a.

Turns out, the commit did more harm than good. It changed
semantics on some public APIs. For instance, while
qemuDomainGetInfo() previously did not returned an error it does
now. While the calls to virProcessGetStatInfo() is guarded with
virDomainObjIsActive() it doesn't necessarily mean that QEMU's
PID is still alive. QEMU might be gone but we just haven't
realized it (e.g. because the eof handler thread is waiting for a
job).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agotests: update QEMU and domain ppc64 capabilities for qemu 7.0
Daniel Henrique Barboza [Mon, 17 Jan 2022 17:45:28 +0000 (14:45 -0300)]
tests: update QEMU and domain ppc64 capabilities for qemu 7.0

Changes in all 'ppc64-latest.ags' files were needed due to the
JSONification of command line devices.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 20 Jan 2022 13:46:21 +0000 (14:46 +0100)]
Translated using Weblate (Swedish)

Currently translated at 31.3% (3281 of 10455 strings)

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

Translated using Weblate (Swedish)

Currently translated at 31.2% (3266 of 10455 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>
3 years agoTranslated using Weblate (Korean)
simmon [Thu, 20 Jan 2022 13:46:20 +0000 (14:46 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10455 of 10455 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.7% (10434 of 10455 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>
3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Thu, 20 Jan 2022 13:46:19 +0000 (14:46 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.8% (2392 of 10455 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>
3 years agoqemu: fix inactive snapshot revert
Ján Tomko [Thu, 20 Jan 2022 13:53:33 +0000 (14:53 +0100)]
qemu: fix inactive snapshot revert

The commit splitting out the qemuSnapshotRevertInactive function
dropped the 'defined = true' line by accident and instead
returned -1, leaving the user with a cryptic error:
error: An error occurred, but the cause is unknown

https://bugzilla.redhat.com/show_bug.cgi?id=2039136
https://gitlab.com/libvirt/libvirt/-/issues/266

Fixes: 85e4a13c3f19078fb6af5ffb4a80022c142cbc7e
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agostorage: Implement 'checkPool' method for 'disk' type pools
Peter Krempa [Thu, 20 Jan 2022 10:46:51 +0000 (11:46 +0100)]
storage: Implement 'checkPool' method for 'disk' type pools

If 'checkPool' is not implemented, the pool will be made inactive when
restarting libvirtd and subsequently re-loading the state from the pool
state XML.

Base the 'checkPool' implementation on logic similar to 'startPool'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1910856
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirStoragePoolObjSourceFindDuplicateCb: Fix handling of VIR_STORAGE_POOL_ISCSI_DIRECT
Peter Krempa [Thu, 20 Jan 2022 10:43:22 +0000 (11:43 +0100)]
virStoragePoolObjSourceFindDuplicateCb: Fix handling of VIR_STORAGE_POOL_ISCSI_DIRECT

The direct SCSI pool doesn't expose the volumes in the host attempting
to match it using 'virStoragePoolObjSourceMatchTypeDEVICE' which in turn
uses 'virStoragePoolSourceFindDuplicateDevices' doesn't make sense.

Remove it from the source matching completely as we can open multiple
connections to the target.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agostorageDriverAutostartCallback: Refactor control flow
Peter Krempa [Thu, 20 Jan 2022 10:36:29 +0000 (11:36 +0100)]
storageDriverAutostartCallback: Refactor control flow

Use early returns to decrease the indentation level and make it more
obvious that the 'cleanup' path is a noop in those cases.

'virStoragePoolObjSetStarting' was called only when the code wanted to
start the pool, so if that was skipped, cleanup is noop as it's
conditional on the return value of 'virStoragePoolObjIsStarting'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirStoragePoolObjLoadAllConfigs: Use automatic memory clearing
Peter Krempa [Thu, 20 Jan 2022 10:34:46 +0000 (11:34 +0100)]
virStoragePoolObjLoadAllConfigs: Use automatic memory clearing

Refactor the inner loop to automatically free temporary variables and
remove unreachable error paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agostorage: Add debug logs for storage pool config loading
Peter Krempa [Thu, 20 Jan 2022 10:33:46 +0000 (11:33 +0100)]
storage: Add debug logs for storage pool config loading

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: man: virsh: Document more carefully that 'guestinfo' can return nothing
Peter Krempa [Wed, 19 Jan 2022 08:49:31 +0000 (09:49 +0100)]
docs: man: virsh: Document more carefully that 'guestinfo' can return nothing

When invoking 'virsh guestinfo $VM' without explicitly specifying a
group of information to return, virsh always reports success even when
the guest agent doesn't report any information in the current state.
This is desired in situations when you are okay with stats being missing
and avoids spurious errors being reported.

Clarify that this is really desired in the man page.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041665
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
3 years agokbase: debuglogs: Emphasise 'virt-admin'
Peter Krempa [Mon, 17 Jan 2022 13:34:36 +0000 (14:34 +0100)]
kbase: debuglogs: Emphasise 'virt-admin'

It's a tool name so use backticks to format it in monospace.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Extract client library logging setup
Peter Krempa [Mon, 17 Jan 2022 12:59:58 +0000 (13:59 +0100)]
kbase: debuglogs: Extract client library logging setup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Add a section describing log outputs and filters
Peter Krempa [Mon, 17 Jan 2022 12:45:02 +0000 (13:45 +0100)]
kbase: debuglogs: Add a section describing log outputs and filters

Outline what the given settings influence.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Section off the settings for legacy libvirt
Peter Krempa [Mon, 17 Jan 2022 11:15:17 +0000 (12:15 +0100)]
kbase: debuglogs: Section off the settings for legacy libvirt

Move out the settings required to pre libvirt-4.4.0 deployments into a
separate section so that the main point is not cluttered by now mostly
irrelevant settings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Un-nest section on enabling debug logs
Peter Krempa [Mon, 17 Jan 2022 10:55:40 +0000 (11:55 +0100)]
kbase: debuglogs: Un-nest section on enabling debug logs

Enabling the logs is the focus of this article. Decouple it from the
first section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agokbase: debuglogs: Use common heading hierarchy
Peter Krempa [Mon, 17 Jan 2022 10:04:15 +0000 (11:04 +0100)]
kbase: debuglogs: Use common heading hierarchy

Use the heading hierarchy as generated by pandoc which we use in most
of the converted XML format docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agospec: Run pre/post-install stuff on 'daemon-driver-storage-core'
Peter Krempa [Wed, 19 Jan 2022 12:41:28 +0000 (13:41 +0100)]
spec: Run pre/post-install stuff on 'daemon-driver-storage-core'

'daemon-driver-storage' is just a meta-package, the actual daemon is in
the 'daemon-driver-storage-core' package, so without installing the meta
package the storage daemon is not being enabled.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2025644
Fixes: 50eae3f8859, b8ef6255444
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoremote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit
Peter Krempa [Tue, 18 Jan 2022 14:00:21 +0000 (15:00 +0100)]
remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit

The existence of the unix socket path is used by the remote driver to
determine whether modular daemons are in use, so if the socket file
stays behind and the user decided to switch from modular to monolithic
daemon which was socket activated, the remote driver will insist on
picking '/var/run/libvirt/virtqemud-sock', even when it's no longer in
use:

 # systemctl start libvirtd.service
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop libvirtd.service
 Warning: Stopping libvirtd.service, but it can still be activated by:
   libvirtd.socket
   libvirtd-ro.socket
   libvirtd-admin.socket
 # systemctl start virtqemud.socket
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop virtqemud.socket
 # systemctl start libvirtd.service
 # virsh list
 error: failed to connect to the hypervisor
 error: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': Connection refused

 # virsh -c 'qemu:///system?socket=/var/run/libvirt/libvirt-sock' list
  Id   Name   State
 --------------------

Fix this by instructing systemd to delete the socket file when
deactivating the unit file for the socket.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
3 years agoqemuValidateDomainDeviceDefVideo: Reject non-default video head count for devices...
Peter Krempa [Tue, 18 Jan 2022 15:59:35 +0000 (16:59 +0100)]
qemuValidateDomainDeviceDefVideo: Reject non-default video head count for devices not supporting it

Only QXL and virtio-vga actually propagate the 'heads' attribute as
'max_outputs' to the commandline of qemu. Reject the setting when
non-default value is used for any other video type.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2036300
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>