From: Jiri Denemark Date: Wed, 1 Mar 2023 11:55:18 +0000 (+0100) Subject: qemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR X-Git-Tag: v9.2.0-rc1~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9a36fb9e1b27d1f4eb236fba132953a2cf21061;p=thirdparty%2Flibvirt.git qemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR Other APIs that internally use QEMU migration and need to temporarily suspend a domain already report failure to resume vCPUs by setting VIR_DOMAIN_PAUSED_API_ERROR state reason and emitting VIR_DOMAIN_EVENT_SUSPENDED event with VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR. Let's do the same in qemuMigrationSrcRestoreDomainState for consistent behavior. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2720f0b083..efec1b3be6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -251,6 +251,16 @@ qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm) * overwrite the previous error, though, so we just throw something * to the logs and hope for the best */ VIR_ERROR(_("Failed to resume guest %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; } ret = true;