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

[libvirt] [PATCH 3/6] 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 70e9c70..3d5ef92 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6008,8 +6008,9 @@ qemudDomainMigratePerform (virDomainPtr dom,
         /* Pause domain for non-live migration */
         if (qemuMonitorStopCPUs(vm) < 0)
             goto cleanup;
-        paused = 1;
 
+        paused = (vm->state == VIR_DOMAIN_RUNNING);
+        vm->state = VIR_DOMAIN_PAUSED;
         event = virDomainEventNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_SUSPENDED,
                                          VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
@@ -6085,6 +6086,7 @@ cleanup:
                       vm->def->name);
         }
 
+        vm->state = VIR_DOMAIN_RUNNING;
         event = virDomainEventNewFromObj(vm,
                                          VIR_DOMAIN_EVENT_RESUMED,
                                          VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
-- 
1.6.2.5



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