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

[libvirt] [PATCH 2/2] check whether the vm is paused before setting it offline



If we do not performe a live migration, the vm is always paused when we go to
doPeer2PeerMigrate2() and doPeer2PeerMigrate3(), because we stop the vm in
qemuMigrationPerform(). So we should check it before setting it offline.

---
 src/qemu/qemu_migration.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ab28416..30167f2 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1614,9 +1614,6 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,
                                         VIR_DOMAIN_XML_UPDATE_CPU)))
         return -1;
 
-    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
-        flags |= VIR_MIGRATE_PAUSED;
-
     VIR_DEBUG("Prepare2 %p", dconn);
     if (flags & VIR_MIGRATE_TUNNELLED) {
         /*
@@ -1748,9 +1745,6 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
     if (!dom_xml)
         goto cleanup;
 
-    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
-        flags |= VIR_MIGRATE_PAUSED;
-
     VIR_DEBUG("Prepare3 %p", dconn);
     cookiein = cookieout;
     cookieinlen = cookieoutlen;
@@ -1985,6 +1979,9 @@ int qemuMigrationPerform(struct qemud_driver *driver,
     memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
     priv->jobInfo.type = VIR_DOMAIN_JOB_UNBOUNDED;
 
+    if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
+        flags |= VIR_MIGRATE_PAUSED;
+
     resume = virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING;
     if (!(flags & VIR_MIGRATE_LIVE) &&
         virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
-- 
1.7.1


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