Commit Graph

46216 Commits

Author SHA1 Message Date
Martin Kletzander
69e0e33873 qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed
Commit 6262752460 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>
2022-07-22 12:47:32 +02:00
Peter Krempa
1122b16276 virclosecallbacks: Remove unused virCloseCallbacksGetConn
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-07-22 11:11:42 +02:00
Peter Krempa
8eeb284499 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>
2022-07-22 11:11:42 +02:00
Peter Krempa
6d155a5a8e 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>
2022-07-22 11:11:42 +02:00
Peter Krempa
5cd1656463 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>
2022-07-22 11:11:42 +02:00
Peter Krempa
5b15917730 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>
2022-07-22 11:11:42 +02:00
Peter Krempa
ed0507b58a 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>
2022-07-22 11:11:42 +02:00
Peter Krempa
e44a5f43cb 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>
2022-07-22 11:11:42 +02:00
Laine Stump
25883cd5f0 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>
2022-07-21 11:12:46 -04:00
Laine Stump
2dd5587f1d 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: 156e99f686
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-07-21 11:12:44 -04:00
Jiri Denemark
6262752460 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>
2022-07-21 17:02:13 +02:00
Kristina Hanicova
356669955a 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>
2022-07-21 15:02:51 +02:00
Kristina Hanicova
f78e59c197 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>
2022-07-21 15:02:49 +02:00
Kristina Hanicova
6c1dec40a2 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>
2022-07-21 15:02:47 +02:00
Kristina Hanicova
260a091982 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>
2022-07-21 15:02:44 +02:00
Michal Privoznik
f87dc1c49e 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>
2022-07-21 14:49:42 +02:00
Michal Privoznik
086bbbad09 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>
2022-07-21 14:45:50 +02:00
Eugenio Pérez
2103807e33 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>
2022-07-21 00:58:06 -04:00
Eugenio Pérez
156e99f686 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>
2022-07-21 00:58:06 -04:00
Eugenio Pérez
7e52c4839f 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>
2022-07-21 00:58:06 -04:00
Jonathon Jongsma
1e9d84d9f9 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>
2022-07-21 00:58:06 -04:00
Jan Kuparinen
ccfdc6b029 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>
2022-07-20 16:57:05 +02:00
김인수
187c9b7363 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>
2022-07-20 16:57:05 +02:00
minglei.liu
3078799fef 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>
2022-07-20 16:53:51 +02:00
Han Han
7b28561c85 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>
2022-07-20 14:59:26 +02:00
Kristina Hanicova
3945327839 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>
2022-07-20 14:54:30 +02:00
Kristina Hanicova
dc0ae3a50f 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>
2022-07-20 14:43:23 +02:00
Kristina Hanicova
c228910d26 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>
2022-07-20 14:43:22 +02:00
Kristina Hanicova
fb2fdba2f0 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>
2022-07-20 14:43:20 +02:00
Kristina Hanicova
e8046532a7 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>
2022-07-20 14:43:19 +02:00
Kristina Hanicova
badb7972fd 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>
2022-07-20 14:43:14 +02:00
Kristina Hanicova
2e480f0c64 hypervisor: domain_job: add and edit description
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-20 14:35:19 +02:00
Kristina Hanicova
34c9782d28 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>
2022-07-20 14:34:15 +02:00
Jonathon Jongsma
f52dbac93f 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>
2022-07-19 10:59:08 -05:00
Michal Privoznik
a9d1c08b71 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>
2022-07-19 14:24:28 +02:00
Michal Privoznik
4e39625095 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>
2022-07-19 14:24:20 +02:00
Michal Privoznik
9e8601c464 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: 15cd0f0461
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-07-18 17:23:15 +02:00
Michal Privoznik
b9e3ab53e5 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: a6f8fe071e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-07-18 17:23:15 +02:00
Tim Wiederhake
57d263d6a3 docs: Fix typos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2022-07-18 11:10:55 +02:00
Jonathon Jongsma
62ca300530 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>
2022-07-15 16:44:39 -05:00
Peter Krempa
d531b9c724 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>
2022-07-15 15:57:10 +02:00
Peter Krempa
e2b86ffa19 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>
2022-07-15 15:57:10 +02:00
Peter Krempa
06e0ba3da7 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>
2022-07-15 15:57:10 +02:00
Peter Krempa
af2d983567 qemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-15 15:57:10 +02:00
Peter Krempa
70d141fea5 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>
2022-07-15 15:57:10 +02:00
Peter Krempa
ce761753d3 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>
2022-07-15 15:57:10 +02:00
Peter Krempa
6810cc45f7 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>
2022-07-15 15:57:09 +02:00
Erik Skultety
c341989fa1 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>
2022-07-15 08:26:38 +02:00
Erik Skultety
659ac70281 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>
2022-07-15 08:26:34 +02:00
Erik Skultety
294b5a9821 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>
2022-07-15 08:26:29 +02:00