- qemu_migration: Refactor qemuMigrationSrcRestoreDomainState (RHEL-79168) - qemu_migration: Do not automatically resume domain after I/O error (RHEL-79168) - qemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 (RHEL-79095) - qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1636-gffaf7f0376' (RHEL-79095) - qemu: capabilies: Introduce QEMU_CAPS_BLOCKDEV_SET_ACTIVE (RHEL-79095) - qemu: monitor: Add monitor backend for 'blockdev-set-active' (RHEL-79095) - qemu: migration: Reactivate block nodes after migration if VM is left paused (RHEL-79095) - conf: change virDomainHostdevInsert() to return void (RHEL-69455) - qemu: fix qemu validation to forbid guest-side IP address for type='vdpa' (RHEL-69455) - qemu: validate that model is virtio for vhostuser and vdpa interfaces in the same place (RHEL-69455) - qemu: automatically set model type='virtio' for interface type='vhostuser' (RHEL-69455) - qemu: do all vhostuser attribute validation in qemu driver (RHEL-69455) - conf/qemu: make <source> element *almost* optional for type=vhostuser (RHEL-69455) - qemu: use switch instead of if in qemuProcessPrepareDomainNetwork() (RHEL-69455) - qemu: make qemuPasstCreateSocketPath() public (RHEL-69455) - qemu: complete vhostuser + passt support (RHEL-69455) - qemu: fail validation if a domain def has vhostuser/passt but no shared mem (RHEL-69455) - docs: improve type='user' docs to higlight differences between SLIRP and passt (RHEL-69455) - docs: document using passt backend with <interface type='vhostuser'> (RHEL-69455) - utils: Canonicalize paths before comparing them (RHEL-79166) Resolves: RHEL-69455, RHEL-79095, RHEL-79166, RHEL-79168
111 lines
4.7 KiB
Diff
111 lines
4.7 KiB
Diff
From 68d485113af90e52dfa52c40f2192b524f31de4f Mon Sep 17 00:00:00 2001
|
|
Message-ID: <68d485113af90e52dfa52c40f2192b524f31de4f.1739824249.git.jdenemar@redhat.com>
|
|
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Wed, 15 Jan 2025 15:59:22 +0100
|
|
Subject: [PATCH] qemu_migration: Refactor qemuMigrationSrcRestoreDomainState
|
|
|
|
None of the callers really care about the return value so we can drop it
|
|
and simplify the code a bit.
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
(cherry picked from commit e46e64be501cd670a3f224fabd97705fb01c6f85)
|
|
|
|
https://issues.redhat.com/browse/RHEL-79168
|
|
---
|
|
src/qemu/qemu_migration.c | 64 +++++++++++++++++----------------------
|
|
1 file changed, 28 insertions(+), 36 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
index b2b172a26c..fe0b9fc672 100644
|
|
--- a/src/qemu/qemu_migration.c
|
|
+++ b/src/qemu/qemu_migration.c
|
|
@@ -219,57 +219,49 @@ qemuMigrationSrcStoreDomainState(virDomainObj *vm)
|
|
priv->preMigrationState, vm);
|
|
}
|
|
|
|
-/* Returns true if the domain was resumed, false otherwise */
|
|
-static bool
|
|
+
|
|
+static void
|
|
qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
|
|
{
|
|
qemuDomainObjPrivate *priv = vm->privateData;
|
|
+ virDomainState preMigrationState = priv->preMigrationState;
|
|
int reason;
|
|
virDomainState state = virDomainObjGetState(vm, &reason);
|
|
- bool ret = false;
|
|
+
|
|
+ priv->preMigrationState = VIR_DOMAIN_NOSTATE;
|
|
|
|
VIR_DEBUG("driver=%p, vm=%p, pre-mig-state=%s, state=%s, reason=%s",
|
|
driver, vm,
|
|
- virDomainStateTypeToString(priv->preMigrationState),
|
|
+ virDomainStateTypeToString(preMigrationState),
|
|
virDomainStateTypeToString(state),
|
|
virDomainStateReasonToString(state, reason));
|
|
|
|
- if (state != VIR_DOMAIN_PAUSED ||
|
|
+ if (preMigrationState != VIR_DOMAIN_RUNNING ||
|
|
+ state != VIR_DOMAIN_PAUSED ||
|
|
reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED)
|
|
- goto cleanup;
|
|
+ return;
|
|
|
|
- if (priv->preMigrationState == VIR_DOMAIN_RUNNING) {
|
|
- /* This is basically the only restore possibility that's safe
|
|
- * and we should attempt to do */
|
|
-
|
|
- VIR_DEBUG("Restoring pre-migration state due to migration error");
|
|
-
|
|
- /* we got here through some sort of failure; start the domain again */
|
|
- if (qemuProcessStartCPUs(driver, vm,
|
|
- VIR_DOMAIN_RUNNING_MIGRATION_CANCELED,
|
|
- VIR_ASYNC_JOB_MIGRATION_OUT) < 0) {
|
|
- /* Hm, we already know we are in error here. We don't want to
|
|
- * overwrite the previous error, though, so we just throw something
|
|
- * to the logs and hope for the best */
|
|
- VIR_ERROR(_("Failed to resume guest %1$s after failure"), vm->def->name);
|
|
- if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
|
|
- virObjectEvent *event;
|
|
-
|
|
- virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
|
|
- VIR_DOMAIN_PAUSED_API_ERROR);
|
|
- event = virDomainEventLifecycleNewFromObj(vm,
|
|
- VIR_DOMAIN_EVENT_SUSPENDED,
|
|
- VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
|
|
- virObjectEventStateQueue(driver->domainEventState, event);
|
|
- }
|
|
- goto cleanup;
|
|
+ VIR_DEBUG("Restoring pre-migration state due to migration error");
|
|
+
|
|
+ /* we got here through some sort of failure; start the domain again */
|
|
+ if (qemuProcessStartCPUs(driver, vm,
|
|
+ VIR_DOMAIN_RUNNING_MIGRATION_CANCELED,
|
|
+ VIR_ASYNC_JOB_MIGRATION_OUT) < 0) {
|
|
+ /* Hm, we already know we are in error here. We don't want to
|
|
+ * overwrite the previous error, though, so we just throw something
|
|
+ * to the logs and hope for the best */
|
|
+ VIR_ERROR(_("Failed to resume guest %1$s after failure"), vm->def->name);
|
|
+ if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
|
|
+ virObjectEvent *event;
|
|
+
|
|
+ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
|
|
+ VIR_DOMAIN_PAUSED_API_ERROR);
|
|
+ event = virDomainEventLifecycleNewFromObj(vm,
|
|
+ VIR_DOMAIN_EVENT_SUSPENDED,
|
|
+ VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
|
|
+ virObjectEventStateQueue(driver->domainEventState, event);
|
|
}
|
|
- ret = true;
|
|
}
|
|
-
|
|
- cleanup:
|
|
- priv->preMigrationState = VIR_DOMAIN_NOSTATE;
|
|
- return ret;
|
|
}
|
|
|
|
|
|
--
|
|
2.48.1
|