The events would normally be triggered only if we're changing domain
state. But most of the time the domain is already in the right state and
we're just changing its substate from {PAUSED,RUNNING}_POSTCOPY to
*_POSTCOPY_FAILED. Let's emit lifecycle events explicitly when post-copy
migration fails to make the failure visible without polling.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
Reviewed-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Notes:
Version 2:
- no change
src/qemu/qemu_migration.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 326e17ddd7..274386d6d9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1579,6 +1579,9 @@ qemuMigrationSrcIsSafe(virDomainDef *def,
void
qemuMigrationSrcPostcopyFailed(virDomainObj *vm)
{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ virQEMUDriver *driver = priv->driver;
+ virObjectEvent *event = NULL;
virDomainState state;
int reason;
@@ -1597,12 +1600,18 @@ qemuMigrationSrcPostcopyFailed(virDomainObj *vm)
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
+ event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
+
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
void
qemuMigrationDstPostcopyFailed(virDomainObj *vm)
{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ virQEMUDriver *driver = priv->driver;
+ virObjectEvent *event = NULL;
virDomainState state;
int reason;
@@ -1622,6 +1631,9 @@ qemuMigrationDstPostcopyFailed(virDomainObj *vm)
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_POSTCOPY_FAILED);
+ event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_RESUMED,
+ VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
--
2.35.1