]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemu: Assign default alias to IOMMU devices
Andrea Bolognani [Thu, 21 Jul 2022 09:04:10 +0000 (11:04 +0200)]
qemu: Assign default alias to IOMMU devices

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoschema: Allow IOMMU devices to have aliases
Andrea Bolognani [Thu, 21 Jul 2022 09:18:07 +0000 (11:18 +0200)]
schema: Allow IOMMU devices to have aliases

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_hotplug: Create chardev files before attempting to relabel them
Michal Privoznik [Mon, 18 Jul 2022 14:13:12 +0000 (16:13 +0200)]
qemu_hotplug: Create chardev files before attempting to relabel them

When hotplugging a chardev, Libvirt opens corresponding
file/binds to a socket/does whatever necessary to obtain an FD
that is later passed to QEMU. However, due to wrong placement of
the function that does all of this
(qemuProcessPrepareHostBackendChardevHotplug()) it may happen
that a file is set seclabel on, only to be unlink()-ed and
created again (the former is done by
qemuSecuritySetChardevLabel(), the latter by aforementioned
function). The unlink()-ing is done for UNIX sockets with
mode='bind' and happens inside qemuOpenChrChardevUNIXSocket().
However, these steps can be swapped simply.

Fixes: ad81aa8ad07e52c9bd4840de84d2ed59998b4d2a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemu_hotplug: Close FDs in QEMU on failed chardev hotplug
Michal Privoznik [Mon, 18 Jul 2022 14:29:07 +0000 (16:29 +0200)]
qemu_hotplug: Close FDs in QEMU on failed chardev hotplug

When hotplugging a chardev, Libvirt opens corresponding
file/binds to a socket/does whatever necessary to obtain an FD
that is later passed to QEMU. However, if something fails after
the FDs were transferred to QEMU and before chardev is actually
added via monitor, these FDs are never closed in QEMU. This is
rather suboptimal.

Fixes: 15bdced9b3d0b86a48506bfb1c27d6b2d5377dc2
Fixes: ad81aa8ad07e52c9bd4840de84d2ed59998b4d2a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agodomain_conf: rewrite if else functions to switch
Kristina Hanicova [Thu, 21 Jul 2022 11:30:45 +0000 (13:30 +0200)]
domain_conf: rewrite if else functions to switch

Pattern of using switch instead of a long if else construction is
used everywhere, so I used it here as well to make the code more
consistent (and remove that else after return). I also included
all the values from the enum.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: remove else after return / goto
Kristina Hanicova [Thu, 21 Jul 2022 11:30:44 +0000 (13:30 +0200)]
domain_conf: remove else after return / goto

The else branches are redundant because the execution will never
reach them if the conditions in the previous 'if' branches are
true.

I think this looks cleaner and is more readable, because having
'else' branch indicates that no return / break / goto is in the
previous branch and the function can reach it.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: rewrite variable setting
Kristina Hanicova [Thu, 21 Jul 2022 10:45:53 +0000 (12:45 +0200)]
domain_conf: rewrite variable setting

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: rewrite conditions in virDomainObjWaitUntil()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:52 +0000 (12:45 +0200)]
domain_conf: rewrite conditions in virDomainObjWaitUntil()

This patch rewrites conditions to make the code easier to read and less
nested.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: use early return in virDomainObjAssignDef()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:51 +0000 (12:45 +0200)]
domain_conf: use early return in virDomainObjAssignDef()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: extend switch in virDomainChrDefFree()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:50 +0000 (12:45 +0200)]
domain_conf: extend switch in virDomainChrDefFree()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_conf: remove breaks after return in virDomainChrSourceDefIsEqual()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:49 +0000 (12:45 +0200)]
domain_conf: remove breaks after return in virDomainChrSourceDefIsEqual()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_capabilities: reformat virDomainCapsCPUCustomFormat()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:48 +0000 (12:45 +0200)]
domain_capabilities: reformat virDomainCapsCPUCustomFormat()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_capabilities: reformat virDomainCapsFeatureSEVFormat()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:47 +0000 (12:45 +0200)]
domain_capabilities: reformat virDomainCapsFeatureSEVFormat()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodomain_capabilities: use early return in virDomainCapsFeatureSEVFormat()
Kristina Hanicova [Thu, 21 Jul 2022 10:45:46 +0000 (12:45 +0200)]
domain_capabilities: use early return in virDomainCapsFeatureSEVFormat()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed
Martin Kletzander [Fri, 22 Jul 2022 10:20:04 +0000 (12:20 +0200)]
qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed

Commit 62627524607f added the acquiring of a job, but it is not always
VIR_ASYNC_JOB_MIGRATION_OUT, so the code fails when doing save or anything else.
Correct the async job by passing it from the caller as another parameter.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agovirclosecallbacks: Remove unused virCloseCallbacksGetConn
Peter Krempa [Wed, 29 Jun 2022 12:03:06 +0000 (14:03 +0200)]
virclosecallbacks: Remove unused virCloseCallbacksGetConn

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessReboot: Remove the need to re-register autodestroy callback
Peter Krempa [Tue, 28 Jun 2022 15:08:00 +0000 (17:08 +0200)]
virLXCProcessReboot: Remove the need to re-register autodestroy callback

Add a new flag VIR_LXC_PROCESS_CLEANUP_AUTODESTROY to
virLXCProcessCleanupFlags for skipping removal of the autodestroy
callback so that fake reboot of the container doesn't need to fetch the
connection and re-register it.

Since virLXCProcessReboot is defined before virLXCProcessCleanupFlags,
this patch also moves the flag enum typedef to the beginning of the
file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessAutostartDomain: Refactor control flow and variable use
Peter Krempa [Tue, 28 Jun 2022 14:52:38 +0000 (16:52 +0200)]
virLXCProcessAutostartDomain: Refactor control flow and variable use

Use automatic unlocking of the 'vm' object, so that we can return early
when no autostart is needed and avoid passing of the 'driver' object
which is already present in 'vm's' private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessAutostartAll: Remove unused 'conn'
Peter Krempa [Tue, 28 Jun 2022 14:45:01 +0000 (16:45 +0200)]
virLXCProcessAutostartAll: Remove unused 'conn'

The connection object is not needed when autostarting containers so we
can remove the machinery for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessReboot: Simplify cleanup
Peter Krempa [Tue, 28 Jun 2022 14:32:12 +0000 (16:32 +0200)]
virLXCProcessReboot: Simplify cleanup

Remove the pointless 'cleanup' section and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessStart: Pass in virConnect object only when registering autodestroy
Peter Krempa [Tue, 28 Jun 2022 14:30:34 +0000 (16:30 +0200)]
virLXCProcessStart: Pass in virConnect object only when registering autodestroy

The function doesn't really need the connect object for anything besides
registering the autodestroy callback for it. If we merge it certain
callers can be simplified.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agovirLXCProcessStop: Add 'cleanupFlags' parameter
Peter Krempa [Tue, 28 Jun 2022 14:20:29 +0000 (16:20 +0200)]
virLXCProcessStop: Add 'cleanupFlags' parameter

Add possibility for the caller to set the flags for the call to
'virLXCProcessCleanup'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoqemu: skip hardcoded hostdev migration check if QEMU can do it for us
Laine Stump [Thu, 21 Jul 2022 06:03:49 +0000 (02:03 -0400)]
qemu: skip hardcoded hostdev migration check if QEMU can do it for us

libvirt currently will block migration for any vfio-assigned device
unless it is a network device that is associated with a virtio-net
failover device (ie. if the hostdev object has a teaming->type ==
VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT).

In the future there will be other vfio devices that can be migrated,
so we don't want to rely on this hardcoded block. QEMU 6.0+ will
anyway inform us of any devices that will block migration (as a part
of qemuDomainGetMigrationBlockers()), so we only need to do the
hardcoded check in the case of old QEMU that can't provide that
information.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoqemu: don't try to query QEMU about migration blockers during offline migration
Laine Stump [Thu, 21 Jul 2022 05:56:11 +0000 (01:56 -0400)]
qemu: don't try to query QEMU about migration blockers during offline migration

The new code that queries QEMU about migration blockers was put at the
top of qemuMigrationSrcIsAllowed(), but that function can also be
called in the case of offline migration (ie when the domain is
inactive / QEMU isn't running). This check should have been put inside
the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move
it there.

Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoqemu_migration: Use EnterMonitorAsync in qemuDomainGetMigrationBlockers
Jiri Denemark [Thu, 21 Jul 2022 13:00:28 +0000 (15:00 +0200)]
qemu_migration: Use EnterMonitorAsync in qemuDomainGetMigrationBlockers

The code is run with an async job and thus needs to make sure a nested
job is acquired before entering the monitor.

While touching the code in qemuMigrationSrcIsAllowed I also fixed the
grammar which was accidentally broken by v8.5.0-140-g2103807e33.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoCH: use virDomainObjInitJob()
Kristina Hanicova [Thu, 21 Jul 2022 11:54:49 +0000 (13:54 +0200)]
CH: use virDomainObjInitJob()

This patch removes and replaces virCHDomainObjInitJob() with
general virDomainObjInitJob().

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoLXC: use virDomainObjInitJob()
Kristina Hanicova [Thu, 21 Jul 2022 11:54:48 +0000 (13:54 +0200)]
LXC: use virDomainObjInitJob()

This patch removes and replaces virLXCDomainObjInitJob() with
general virDomainObjInitJob().

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: use virDomainObjInitJob()
Kristina Hanicova [Thu, 21 Jul 2022 11:54:47 +0000 (13:54 +0200)]
libxl: use virDomainObjInitJob()

This patch removes and replaces libxlDomainObjInitJob() with
general virDomainObjInitJob().

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move qemuDomainObjInitJob() into hypervisor
Kristina Hanicova [Thu, 21 Jul 2022 11:54:46 +0000 (13:54 +0200)]
qemu & hypervisor: move qemuDomainObjInitJob() into hypervisor

This patch moves qemuDomainObjInitJob() as virDomainObjInitJob()
into hypervisor in order to be used by other drivers as well.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_cgroup: Introduce qemuCgroupAllowDevicesPaths()
Michal Privoznik [Thu, 21 Jul 2022 09:06:26 +0000 (11:06 +0200)]
qemu_cgroup: Introduce qemuCgroupAllowDevicesPaths()

We have qemuCgroupAllowDevicePath() which sets up devices
controller for just one path. And if we have more paths we have
to call it in a loop. So far, we have just one such place, but
soon we'll have another one (for SGX memory). Separate the loop
into its own function so that it can be reused.

And while at it, move setting the default set of devices as the
first thing, right after all devices are disallowed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_cgroup: Avoid ternary operator when setting @deviceACL
Michal Privoznik [Thu, 21 Jul 2022 10:23:53 +0000 (12:23 +0200)]
qemu_cgroup: Avoid ternary operator when setting @deviceACL

Inside of the qemuSetupDevicesCgroup() there's @deviceACL
variable, which points to a string list of devices that are
allowed in devices controller by default. This list can either
come from qemu.conf (cfg->cgroupDeviceACL) or from a builtin
@defaultDeviceACL. However, a multiline ternary operator is used
when setting the variable which is against our coding style.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: remove hardcoded migration fail for vDPA devices if we can ask QEMU
Eugenio Pérez [Wed, 20 Jul 2022 16:05:49 +0000 (18:05 +0200)]
qemu: remove hardcoded migration fail for vDPA devices if we can ask QEMU

vDPA devices will be migratable soon, so we shouldn't unconditionally
block migration of any domain with a vDPA device. Instead, we should
rely on QEMU to make the decision when that info is available from the
query-migrate QMP command (QEMU versions too old to have that info in
the results of query-migrate don't support migration of vDPA devices,
so in that case we will continue to unconditionally block migration).

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: query QEMU for migration blockers before our own harcoded checks
Eugenio Pérez [Wed, 20 Jul 2022 16:05:48 +0000 (18:05 +0200)]
qemu: query QEMU for migration blockers before our own harcoded checks

Since QEMU 6.0, if QEMU knows that a migration would fail,
'query-migrate' will return an array of error strings describing the
migration blockers.  This can be used to check whether there are any
devices/conditions blocking migration.

This patch adds a call to this query at the top of
qemuMigrationSrcIsAllowed().

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: new function to retrieve migration blocker reasons from QEMU
Eugenio Pérez [Wed, 20 Jul 2022 16:05:47 +0000 (18:05 +0200)]
qemu: new function to retrieve migration blocker reasons from QEMU

Since QEMU 6.0, if migration is blocked for some reason,
'query-migrate' will return an array of error strings describing the
migration blockers.  This can be used to check whether there are any
devices, or other conditions, that would cause migration to fail.

This patch adds a function that sends this query via a QMP command and
returns the resulting array of reasons. qemuMigrationSrcIsAllowed()
will be able to use the new function to ask QEMU for migration
blockers, instead of the hardcoded guesses that libvirt currently has.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS
Jonathon Jongsma [Wed, 20 Jul 2022 16:05:46 +0000 (18:05 +0200)]
qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS

since qemu 6.0, if migration is blocked for some reason, 'query-migrate'
will return an array of error strings describing the migration blockers.
This can be used to check whether there are any devices blocking
migration, etc.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Tue, 19 Jul 2022 12:27:07 +0000 (14:27 +0200)]
Translated using Weblate (Finnish)

Currently translated at 22.8% (2388 of 10472 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>
2 years agoTranslated using Weblate (Korean)
김인수 [Tue, 19 Jul 2022 12:27:07 +0000 (14:27 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10472 of 10472 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2 years agoqemu: support CDROM hotplug cdrom with USB/SCSI bus
minglei.liu [Wed, 6 Jul 2022 09:57:10 +0000 (02:57 -0700)]
qemu: support CDROM hotplug cdrom with USB/SCSI bus

QEMU supports hotplug of a cdrom device with USB or SCSI bus. Just
unblock these devices in qemuDomainAttachDeviceDiskLiveInternal() and
qemuDomainDetachPrepDisk().

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/261
Signed-off-by: minglei.liu <minglei.liu@smartx.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoschemas: Update ref acpi for devices
Han Han [Tue, 19 Jul 2022 07:02:20 +0000 (15:02 +0800)]
schemas: Update ref acpi for devices

According to a9fe9569ab, the <acpi index='NNN'/> is only for PCI
devices. Remove the ref acpi from devices channel, smartcard, tpm,
redirdev, panic, hub because none of them has PCI address. And add the
ref acpi to iommu device.

Fixes: a9fe9569ab
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomain_conf: rewrite if else condition
Kristina Hanicova [Wed, 20 Jul 2022 12:42:29 +0000 (14:42 +0200)]
domain_conf: rewrite if else condition

This patch prevents nesting of if conditions and makes the code
cleaner.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoCH: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:24 +0000 (15:48 +0200)]
CH: use virDomainJobObj

This patch replaces struct virCHDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:23 +0000 (15:48 +0200)]
libxl: use virDomainJobObj

This patch replaces struct libxlDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoLXC: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:22 +0000 (15:48 +0200)]
LXC: use virDomainJobObj

This patch replaces struct virLXCDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agohypervisor: domain_job: rename members in virDomainObjPrivateJobCallbacks
Kristina Hanicova [Tue, 19 Jul 2022 13:48:21 +0000 (15:48 +0200)]
hypervisor: domain_job: rename members in virDomainObjPrivateJobCallbacks

This patch alters members of virDomainObjPrivateJobCallbacks to
make the code more consistent.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move job object into hypervisor
Kristina Hanicova [Tue, 19 Jul 2022 13:48:20 +0000 (15:48 +0200)]
qemu & hypervisor: move job object into hypervisor

This patch moves qemuDomainJobObj into hypervisor/ as generalized
virDomainJobObj along with generalized private job callbacks as
virDomainObjPrivateJobCallbacks.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agohypervisor: domain_job: add and edit description
Kristina Hanicova [Tue, 19 Jul 2022 12:52:01 +0000 (14:52 +0200)]
hypervisor: domain_job: add and edit description

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: domainjob: remove async variable from qemuDomainObjBeginJobInternal()
Kristina Hanicova [Tue, 19 Jul 2022 12:47:28 +0000 (14:47 +0200)]
qemu: domainjob: remove async variable from qemuDomainObjBeginJobInternal()

This patch removes variable 'async', which is used only once, and
replaces it with direct comparison with an enum member.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: add missing break on a switch case
Jonathon Jongsma [Fri, 15 Jul 2022 17:56:59 +0000 (12:56 -0500)]
conf: add missing break on a switch case

This was not causing any problems because all cases below were empty,
but in order to avoid future misbehavior, add a break to this case.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodomain_conf: Switch to virBufferAddLit for literal strings
Michal Privoznik [Tue, 19 Jul 2022 12:02:52 +0000 (14:02 +0200)]
domain_conf: Switch to virBufferAddLit for literal strings

There's no need to use virBufferAddStr() for literal strings
without any newline character as it's more expensive than
virBufferAddLit().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoqemu_capabilities: Indent <cpudata/> properly
Michal Privoznik [Tue, 19 Jul 2022 11:58:53 +0000 (13:58 +0200)]
qemu_capabilities: Indent <cpudata/> properly

When formatting qemuCaps XML, the <cpudata/> element is
misaligned. This is because it contains multiple lines and
virBufferAsprintf() does not expect that. Switch to
virBufferAddStr() which does.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agolib: Use G_NO_INLINE instead of G_GNUC_NO_INLINE
Michal Privoznik [Mon, 18 Jul 2022 11:02:19 +0000 (13:02 +0200)]
lib: Use G_NO_INLINE instead of G_GNUC_NO_INLINE

The G_GNUC_NO_INLINE macro will eventually be marked as
deprecated [1] and we are recommended to use G_NO_INLINE instead.
Do the switch now, rather than waiting for compile time warning
to occur.

1: https://gitlab.gnome.org/GNOME/glib/-/commit/15cd0f04612c90292792c4d123ebe84bf4bf93a6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoglibcompat: Provide implementation for G_GNUC_NO_INLINE
Michal Privoznik [Mon, 18 Jul 2022 10:48:32 +0000 (12:48 +0200)]
glibcompat: Provide implementation for G_GNUC_NO_INLINE

Currently, we require glib-2.56.0 at minimum (because of RHEL-8)
but we use G_GNUC_NO_INLINE which was introduced in 2.58.0. While
we provide an implementation for older versions, where the macro
does not exists, it's a bit more tricky than that. Since we
define GLIB_VERSION_MAX_ALLOWED we would get a compile time error
when trying to use something too new, except for G_GNUC_NO_INLINE
which was intentionally not marked as
GLIB_AVAILABLE_MACRO_IN_2_58. But this is about to change with
glib-2.73.2 (which contains commit [1]).

At the same time, we can't just bump glib and thus we have to
provide an alternative implementation without the version
annotation.

1: https://gitlab.gnome.org/GNOME/glib/-/commit/a6f8fe071e44b0145619c21f3bfbc90c56ab805e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodocs: Fix typos
Tim Wiederhake [Mon, 18 Jul 2022 09:10:55 +0000 (11:10 +0200)]
docs: Fix typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoutil: remove virObjectUnref() adapters
Jonathon Jongsma [Wed, 13 Jul 2022 20:26:51 +0000 (15:26 -0500)]
util: remove virObjectUnref() adapters

These wrapper functions were used to adapt the virObjectUnref() function
signature for different callbacks. But in commit 0d184072, the
virObjectUnref() function was changed to return a void instead of a
bool, so these adapters are no longer necessary.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu: monitor: Remove unused migration property getters/setters
Peter Krempa [Fri, 15 Jul 2022 12:27:41 +0000 (14:27 +0200)]
qemu: monitor: Remove unused migration property getters/setters

The getters/setters for individual properties of migration
speed/downtime/cache size are unused once we switched to setting them
purely via migration parameters. Remove the unused helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
Peter Krempa [Fri, 15 Jul 2022 12:19:15 +0000 (14:19 +0200)]
qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
Peter Krempa [Fri, 15 Jul 2022 12:16:54 +0000 (14:16 +0200)]
qemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE

The 'xbzrle-cache-size' parameter was added in qemu-2.11 thus all
supported qemu versions now use the new code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Peter Krempa [Fri, 15 Jul 2022 12:13:41 +0000 (14:13 +0200)]
qemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: driver: Always assume support for QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Peter Krempa [Fri, 15 Jul 2022 12:12:28 +0000 (14:12 +0200)]
qemu: driver: Always assume support for QEMU_CAPS_MIGRATION_PARAM_DOWNTIME

The 'downtime-limit' field of 'migrate-set-parameters' was introduced in
qemu-2.8, thus all qemu versions supported by libvirt use the new code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH
Peter Krempa [Fri, 15 Jul 2022 12:10:38 +0000 (14:10 +0200)]
qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH

The parameter is supported since qemu-2.8.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH
Peter Krempa [Fri, 15 Jul 2022 12:07:59 +0000 (14:07 +0200)]
qemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH

The 'max-bandwidth' field was added as argument of
'migrate-set-parameters' in qemu-2.8, thus all qemu version supported by
libvirt already use the new code path.

This patch assumes the presence and removes the legacy code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: ci: Add a brief section on how to run the CI workload locally
Erik Skultety [Tue, 12 Jul 2022 11:44:53 +0000 (13:44 +0200)]
docs: ci: Add a brief section on how to run the CI workload locally

This is just a glue to the testing article introduced in previous
commits.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: ci: Add a section on how to add a new platform to libvirt CI
Erik Skultety [Tue, 12 Jul 2022 11:44:26 +0000 (13:44 +0200)]
docs: ci: Add a section on how to add a new platform to libvirt CI

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: ci: Add info about the two major types of jobs our CI runs
Erik Skultety [Tue, 12 Jul 2022 11:19:14 +0000 (13:19 +0200)]
docs: ci: Add info about the two major types of jobs our CI runs

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Change the CI headline from "CI Testing" to "CI"
Erik Skultety [Tue, 12 Jul 2022 11:40:59 +0000 (13:40 +0200)]
docs: Change the CI headline from "CI Testing" to "CI"

It's not just strategy the master CI article talks (or will talk in the
future) about.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Drop the testsuites article
Erik Skultety [Tue, 12 Jul 2022 11:40:13 +0000 (13:40 +0200)]
docs: Drop the testsuites article

The article was replaced with a new one in previous commit, so we don't
need this one anymore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Replace testsuites article with the new 'testing' article
Erik Skultety [Tue, 12 Jul 2022 11:39:06 +0000 (13:39 +0200)]
docs: Replace testsuites article with the new 'testing' article

The new article provides more in-depth information on testing options
in libvirt.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide an article on testing
Erik Skultety [Tue, 12 Jul 2022 11:32:58 +0000 (13:32 +0200)]
docs: Provide an article on testing

Currently we don't have much information on how testing is done in
libvirt and the little we have is scattered among multiple files. This
patch creates a common landing page containing all important bits about
testing in libvirt, providing links to respective sections which
deserve their own articles.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide an article on how to add a custom runner to the project
Erik Skultety [Mon, 21 Mar 2022 14:11:35 +0000 (15:11 +0100)]
docs: Provide an article on how to add a custom runner to the project

Since running our functional test suite in GitLab cannot make use of
the shared resources it makes sense to document the process of adding
own HW to run the custom libvirt executor that powers the integration
suite. This article will likely make even more sense in the future with
GitLab severely cutting down on shared CI resources.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide more information about the TCK test suite
Erik Skultety [Tue, 12 Jul 2022 11:33:11 +0000 (13:33 +0200)]
docs: Provide more information about the TCK test suite

Most importantly, how to get it, how install dependencies and how
to run it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Move the CI dashboard to its own RST module
Erik Skultety [Tue, 12 Jul 2022 11:15:07 +0000 (13:15 +0200)]
docs: Move the CI dashboard to its own RST module

The dashboard itself simply takes away focus from everything else that
makes sense to have in the CI article, so move it to it's own article
and link it from the main CI article.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 10 Jul 2022 09:19:05 +0000 (11:19 +0200)]
Translated using Weblate (Swedish)

Currently translated at 39.4% (4141 of 10491 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>
2 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sun, 10 Jul 2022 09:19:05 +0000 (11:19 +0200)]
Translated using Weblate (Polish)

Currently translated at 22.2% (2328 of 10472 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
2 years agoqemu: Generate cmd line for guestReset
Michal Privoznik [Thu, 7 Jul 2022 13:26:35 +0000 (15:26 +0200)]
qemu: Generate cmd line for guestReset

QEMU offers two attributes for handling reset requests of an USB
host device: guest-reset and guest-resets-all. When combined they
act as follows:

1) guest-reset=false
   The guest is not allowed to reset the physical USB device.

2) guest-reset=true,guest-resets-all=false
   The guest is allowed to reset the device when it is not yet
   initialized (aka no USB bus address assigned). Usually this results
   in one guest reset being allowed. This is the default behavior.

3) guest-reset=true,guest-resets-all=true
   The guest is allowed to reset the device as it pleases.

Now, there's a clear 1:1 mapping with our representation of
guestReset, so generating cmd line is trivial.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_validate: Validate that QEMU's capable of guestReset
Michal Privoznik [Tue, 12 Jul 2022 10:27:20 +0000 (12:27 +0200)]
qemu_validate: Validate that QEMU's capable of guestReset

Now that we have a capability, validate that the QEMU we are
talking to has everything we need for guestReset.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_capabilities: Track usb-host.guest-resets-all capability
Michal Privoznik [Tue, 12 Jul 2022 10:19:37 +0000 (12:19 +0200)]
qemu_capabilities: Track usb-host.guest-resets-all capability

We will need two attributes of usb-host device to set:
guest-reset and guest-resets-all. The former was introduced in
QEMU v4.0.0-rc0~56^2 and the other in v4.2.0-rc1~9^2. Hence,
track the latter only as it's only starting from that commit when
QEMU has both attributes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Introduce @guestReset to hostdev's <source/>
Michal Privoznik [Thu, 7 Jul 2022 11:11:06 +0000 (13:11 +0200)]
conf: Introduce @guestReset to hostdev's <source/>

Some USB devices have a buggy firmware that either crashes on
device reset, or make the device unusable in some other way.
Fortunately, QEMU offers a way to skip device reset either
completely, or if device is not initialized yet. Expose this
ability to users under:

    <hostdev mode='subsystem' type='usb'>
      <source guestReset='off'/>
    </hostdev>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Fix qemu replies wrt usb-host properties
Michal Privoznik [Wed, 13 Jul 2022 10:17:37 +0000 (12:17 +0200)]
tests: Fix qemu replies wrt usb-host properties

My commit of v6.9.0-rc1~457 was a bit too harsh. While it served
its purpose (adding usb-host.hostdevice capability) it has a side
effect: because I copied reply from qemu-5.1.0 to older .replies
files one might now think that say qemu-3.1.0 supports both
.guest-reset and .guest-resets-all properties. But in fact it
doesn't. There are three problematic properties:

1) guest-reset, introduced in v4.0.0-rc0~56^2
2) guest-resets-all introduced in v4.2.0-rc1~9^2
3) suppress-remote-wake introduced in v5.0.0-rc0~148^2~4

Remove these properties from versions that could not have had
them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests
Michal Privoznik [Tue, 12 Jul 2022 11:00:33 +0000 (13:00 +0200)]
tests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests

Currently, we have bunch of PCI/USB tests cases for
qemuxml2argvtest and qemuxml2xmltest but all of them run without
any capabilities. This makes is needlessly complicated when
trying to extend them. Switch to DO_TEST_CAPS_LATEST().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: replace ARRAY_CARDINALITY with G_N_ELEMENTS
Daniel P. Berrangé [Tue, 24 May 2022 12:25:55 +0000 (13:25 +0100)]
docs: replace ARRAY_CARDINALITY with G_N_ELEMENTS

Fix docs illustrating call with an obsolete macro.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: add info about factors affecting CPU compatibility
Daniel P. Berrangé [Tue, 12 Jul 2022 15:30:17 +0000 (16:30 +0100)]
docs: add info about factors affecting CPU compatibility

While libvirt solves most of the problem of ensuring compatibility, when
there is incompatibility it can be hard for users to track down the
cause. Everything knows to check the physical CPU model, but there are a
surprisingly large number of other factors influencing compatibility.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agovirsh: Implement --config for iothreadset
Michal Privoznik [Thu, 7 Jul 2022 15:44:32 +0000 (17:44 +0200)]
virsh: Implement --config for iothreadset

Our man page already documents that iothreadset has --config
argument. Well, it doesn't really. Normally, I'd just fix the man
page, but with recent work on the API it's possible to tweak
values for inactive XML too. Therefore, implement the --config
argument for the command.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag
Michal Privoznik [Fri, 8 Jul 2022 07:35:39 +0000 (09:35 +0200)]
qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag

It was always possible to modify the inactive XML, because
VIR_DOMAIN_AFFECT_CURRENT (= 0) is accepted implicitly. But now
that the logic when changing both config and live XMLs is more
robust we can accept VIR_DOMAIN_AFFECT_CONFIG flag too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Make IOThread changing more robust
Michal Privoznik [Thu, 7 Jul 2022 15:37:46 +0000 (17:37 +0200)]
qemu: Make IOThread changing more robust

There are three APIs that allow changing IOThreads:

  virDomainAddIOThread()
  virDomainDelIOThread()
  virDomainSetIOThreadParams()

In case of QEMU driver these are handled by
qemuDomainChgIOThread() which attempts to be versatile enough to
work on both inactive and live domain definitions at the same
time. However, it's a bit clumsy - when a change to live
definition succeeds but fails in inactive definition then there's
no rollback. And somewhat rightfully so - changes to live
definition are in general harder to roll back. Therefore, do what
we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(),
qemuDomainDetachDeviceAliasLiveAndConfig(), ...):

  1) do the change to inactive XML first,
  2) in fact, do the change to a copy of inactive XML,
  3) swap inactive XML and its copy only after everything
     succeeded.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_conf: Format iothread IDs more often
Michal Privoznik [Thu, 7 Jul 2022 14:29:33 +0000 (16:29 +0200)]
domain_conf: Format iothread IDs more often

When formatting IOThreads (in virDomainDefIOThreadsFormat()), we
may only output the number of IOThreads, or the full list of IOThreads too:

  <iothreads>4</iothreads>
  <iothreadids>
    <iothread id='1' thread_pool_max='10'/>
    <iothread id='2' thread_pool_min='2' thread_pool_max='10'/>
    <iothread id='3'/>
    <iothread id='4'/>
  </iothreadids>

Now, the deciding factor here is whether those individual
IOThreads were so called 'autofill-ed' or user provided. Well, we
need to take another factor in: if an IOThread has pool size
limit set, then we ought to format the full list.

But how can we get into a situation when a thread is autofilled
(i.e. not provided by user in the XML) and yet it has pool size
limit set? virDomainSetIOThreadParams() is the answer.

Sure, we could also unset the autofill flag whenever a pool size
limit is being set. But this approach allows us to not format
anything if the limits are reset (we don't lose the autofill
information).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_conf: Format <defaultiothread/> more often
Michal Privoznik [Thu, 7 Jul 2022 14:29:18 +0000 (16:29 +0200)]
domain_conf: Format <defaultiothread/> more often

The <defaultiothread/> element is formatted inside
virDomainDefaultIOThreadDefFormat() which is called only from
virDomainDefIOThreadsFormat() (so that IOThread related stuff is
formatted calling one function). However, when there are no
<iothreadids/> defined (or only autoallocated ones are present),
then the outer formatting function exits early never calling the
<defaultiothread/> formatter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Report supported TPM version in domcaps
Michal Privoznik [Tue, 12 Jul 2022 13:58:17 +0000 (15:58 +0200)]
qemu: Report supported TPM version in domcaps

Now that we have everything prepared, we can start detecting
supported TPM versions and setting corresponding values in
backendModel struct.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/340
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodomcaps: Introduce TPM backendVersion
Michal Privoznik [Tue, 12 Jul 2022 13:58:12 +0000 (15:58 +0200)]
domcaps: Introduce TPM backendVersion

We accept TPM version in the domain XML. However, supported
version depends on the host (swtpm_setup binary) and thus it may
be tricky for users (or mgmt applications) chose a version.
Introduce machinery for reporting supported version in domain
capabilities.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis
Michal Privoznik [Tue, 12 Jul 2022 13:46:50 +0000 (15:46 +0200)]
virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis

These new capabilities will be used only to track whether
swtpm_setup is capable of TPM-1.2 and/or TPM-2.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: Document TPM portion of domcaps
Michal Privoznik [Tue, 12 Jul 2022 14:10:08 +0000 (16:10 +0200)]
docs: Document TPM portion of domcaps

Surprisingly, we don't document TPM part of domain capabilities.
Fortunately, the information exposed is pretty much self
explanatory, but we should document it regardless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoremote: conf: Mention that 'virtproxyd' doesn't require the '--listen' flag
Peter Krempa [Tue, 12 Jul 2022 10:45:52 +0000 (12:45 +0200)]
remote: conf: Mention that 'virtproxyd' doesn't require the '--listen' flag

'virtproxyd' doesn't have the '--listen' parameter and it's enough just
to enable the corresponding option in the config.

The config file is generic for all the daemons and we just omit/adjust
some sections. Adding a separate mechanism to omit the note about the
'--listen' parameter would be overkill so mention explicitly that it's
required only for libvirtd and not virtproxyd.

The section is omitted for other daemons.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2094641
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuxml2*test: Add 'startupPolicy' fields to aio-io_uring case
Peter Krempa [Tue, 14 Jun 2022 14:47:51 +0000 (16:47 +0200)]
qemuxml2*test: Add 'startupPolicy' fields to aio-io_uring case

Extend the test for io_uring to also test startup policy.

Since the actual logic for dropping disks is in the host preparation
phase, thus skipped for tests we can use any file path.

Add a case also for 'file' backing to have all cases covered.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: formatstorage: Format XML namespace definition as code block
Peter Krempa [Tue, 12 Jul 2022 09:22:34 +0000 (11:22 +0200)]
docs: formatstorage: Format XML namespace definition as code block

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agovircpi: Add PCIe 5.0 and 6.0 link speeds
Michal Privoznik [Fri, 8 Jul 2022 12:29:32 +0000 (14:29 +0200)]
vircpi: Add PCIe 5.0 and 6.0 link speeds

The PCIe 5.0 and PCIe 6.0 standards define new link speeds:
32GT/s and 64GT/s, respectively. Update our internal enum to
include these new speeds. Otherwise we format incorrect XML:

  <pci-express>
    <link validity='cap' port='0' speed='(null)' width='16'/>
    <link validity='sta' speed='16' width='16'/>
  </pci-express>

Like all "good" specifications, these are also locked behind a
login portal. But we can look at pciutils' source code: [1] and
[2].

1: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=caca31a0eea41c7b051705704c1158fddc02fbd2
2: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=5bdf63b6b1bc35b59c4b3f47f7ca83ca1868155b

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2105231
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Regenerate files with new lcitool
Peter Krempa [Mon, 11 Jul 2022 11:47:02 +0000 (13:47 +0200)]
ci: Regenerate files with new lcitool

Apart from other changes this fixes failures with builds on FreeBSD.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case
Peter Krempa [Wed, 22 Jun 2022 13:28:49 +0000 (15:28 +0200)]
qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case

The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case
Peter Krempa [Wed, 22 Jun 2022 13:28:49 +0000 (15:28 +0200)]
qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case

The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove qemu-4.0 version of 'cpu-translation' test case
Peter Krempa [Wed, 22 Jun 2022 13:07:22 +0000 (15:07 +0200)]
qemu: Remove qemu-4.0 version of 'cpu-translation' test case

The cpu commandline is identical with the '-latest' version so there's
no need for a separate case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting...
Peter Krempa [Wed, 22 Jun 2022 11:30:18 +0000 (13:30 +0200)]
qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu

Make it obvious that the fake cpu does not apply to the test cases based
on real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Make 'qemu-ns' test case more stable
Peter Krempa [Wed, 22 Jun 2022 11:07:53 +0000 (13:07 +0200)]
qemuxml2argvtest: Make 'qemu-ns' test case more stable

The test was showing that the 'blockdev' capability is properly added
although we didn't detect it yet. Unfortunately this test can't be
carried over once we bump minimum qemu version to qemu-4.2.

Make the test case future-proof by removing the qemu-4.0.0 version which
would become pointless and use only already deprecated capability flags
so that the test output does not change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>