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

[libvirt] [PATCH v2 1/3] fix migration of paused vms upon failure



This makes a small change on the failed-migration path.  Up to now,
all VMs that failed non-live migration after the "stop" command
were restarted.  This must not be done when the VM was paused in
the first place.

* src/qemu/qemu_driver.c (qemudDomainMigratePerform): Do not restart
a paused VM that fails migration.  Set paused state after "stop",
reset it after failure.
---
 src/qemu/qemu_driver.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7e60d0e..b7bc677 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7389,7 +7389,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
         goto endjob;
     }
 
-    if (!(flags & VIR_MIGRATE_LIVE)) {
+    if (!(flags & VIR_MIGRATE_LIVE) && vm->state == VIR_DOMAIN_RUNNING) {
         qemuDomainObjPrivatePtr priv = vm->privateData;
         /* Pause domain for non-live migration */
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -7400,6 +7400,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
         qemuDomainObjExitMonitorWithDriver(driver, vm);
         paused = 1;
 
+        vm->state = VIR_DOMAIN_PAUSED;
         event = virDomainEventNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
@@ -7447,6 +7448,7 @@ endjob:
         }
         qemuDomainObjExitMonitorWithDriver(driver, vm);
 
+        vm->state = VIR_DOMAIN_RUNNING;
         event = virDomainEventNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_RESUMED,
                                          VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
-- 
1.6.5.2



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