]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Skip starting NBD servers for offline migration
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 Nov 2015 11:56:29 +0000 (12:56 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 25 Nov 2015 14:27:31 +0000 (15:27 +0100)
NBD storage migration will not work with offline migration anyway and we
already checked that the user did not ask for it. Thus it doesn't make
sense to keep the code after 'done' label where we jump in case of
offline migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_migration.c

index 9a4f19fda722034016f2cc21c01c68334352f6a8..b6525dffda52c2adac38e1dc95a128d92fc83721 100644 (file)
@@ -3418,6 +3418,9 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                              "make sense"));
             goto cleanup;
         }
+        cookieFlags = 0;
+    } else {
+        cookieFlags = QEMU_MIGRATION_COOKIE_GRAPHICS;
     }
 
     if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
@@ -3572,32 +3575,26 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                                QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
         goto stopjob;
 
-    if (mig->lockState) {
-        VIR_DEBUG("Received lockstate %s", mig->lockState);
-        VIR_FREE(priv->lockState);
-        priv->lockState = mig->lockState;
-        mig->lockState = NULL;
-    } else {
-        VIR_DEBUG("Received no lockstate");
-    }
-
- done:
-    if (flags & VIR_MIGRATE_OFFLINE)
-        cookieFlags = 0;
-    else
-        cookieFlags = QEMU_MIGRATION_COOKIE_GRAPHICS;
-
     if (mig->nbd &&
         flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NBD_SERVER)) {
         if (qemuMigrationStartNBDServer(driver, vm, listenAddress,
                                         nmigrate_disks, migrate_disks) < 0) {
-            /* error already reported */
             goto stopjob;
         }
         cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
     }
 
+    if (mig->lockState) {
+        VIR_DEBUG("Received lockstate %s", mig->lockState);
+        VIR_FREE(priv->lockState);
+        priv->lockState = mig->lockState;
+        mig->lockState = NULL;
+    } else {
+        VIR_DEBUG("Received no lockstate");
+    }
+
+ done:
     if (qemuMigrationBakeCookie(mig, driver, vm, cookieout,
                                 cookieoutlen, cookieFlags) < 0) {
         /* We could tear down the whole guest here, but