[libvirt PATCH 07/80] qemu: Explicitly emit events on post-copy failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a5c7a27124..3e3203471a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1581,6 +1581,7 @@ qemuMigrationSrcPostcopyFailed(virDomainObj *vm)
 {
     qemuDomainObjPrivate *priv = vm->privateData;
     virQEMUDriver *driver = priv->driver;
+    virObjectEvent *event = NULL;
     virDomainState state;
     int reason;
 
@@ -1609,6 +1610,9 @@ qemuMigrationSrcPostcopyFailed(virDomainObj *vm)
     } else {
         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);
     }
 }
 
@@ -1616,6 +1620,9 @@ qemuMigrationSrcPostcopyFailed(virDomainObj *vm)
 void
 qemuMigrationDstPostcopyFailed(virDomainObj *vm)
 {
+    qemuDomainObjPrivate *priv = vm->privateData;
+    virQEMUDriver *driver = priv->driver;
+    virObjectEvent *event = NULL;
     virDomainState state;
     int reason;
 
@@ -1634,6 +1641,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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux