[libvirt] (Resend with updates) Live Migration with non-shared storage for kvm

Eric Blake eblake at redhat.com
Tue May 4 22:04:23 UTC 2010


On 05/03/2010 07:52 AM, Cole Robinson wrote:
> On 05/03/2010 04:13 AM, Kenneth Nagin wrote:
>>
> 
> ...
> 
>> This the patch file:
>> (See attached file: libvirt_migration_ns_100503.patch)
>>
> 
> ACK, patch looks fine now.

Kenneth,

I added a commit message, broke a few lines to fit in 80 columns, added
a virCheckFlags to doNativeMigrate (which required a type change), and
removed an extra space in the generated line:

diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 5823e10..47ae52c 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -4958,7 +4958,9 @@ static int qemudDomainSaveFlag(virDomainPtr dom,
const char *path,
     if (header.compressed == QEMUD_SAVE_FORMAT_RAW) {
         const char *args[] = { "cat", NULL };
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        rc = qemuMonitorMigrateToFile(priv->mon,
QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, offset);
+        rc = qemuMonitorMigrateToFile(priv->mon,
+                                      QEMU_MONITOR_MIGRATE_BACKGROUND,
+                                      args, path, offset);
         qemuDomainObjExitMonitorWithDriver(driver, vm);
     } else {
         const char *prog =
qemudSaveCompressionTypeToString(header.compressed);
@@ -4968,7 +4970,9 @@ static int qemudDomainSaveFlag(virDomainPtr dom,
const char *path,
             NULL
         };
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        rc = qemuMonitorMigrateToFile(priv->mon,
QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, offset);
+        rc = qemuMonitorMigrateToFile(priv->mon,
+                                      QEMU_MONITOR_MIGRATE_BACKGROUND,
+                                      args, path, offset);
         qemuDomainObjExitMonitorWithDriver(driver, vm);
     }

@@ -5286,7 +5290,9 @@ static int qemudDomainCoreDump(virDomainPtr dom,
     }

     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    ret = qemuMonitorMigrateToFile(priv->mon,
QEMU_MONITOR_MIGRATE_BACKGROUND, args, path, 0);
+    ret = qemuMonitorMigrateToFile(priv->mon,
+                                   QEMU_MONITOR_MIGRATE_BACKGROUND,
+                                   args, path, 0);
     qemuDomainObjExitMonitorWithDriver(driver, vm);
     if (ret < 0)
         goto endjob;
@@ -9884,7 +9890,7 @@ cleanup:
 static int doNativeMigrate(struct qemud_driver *driver,
                            virDomainObjPtr vm,
                            const char *uri,
-                           unsigned long flags ,
+                           unsigned int flags,
                            const char *dname ATTRIBUTE_UNUSED,
                            unsigned long resource)
 {
@@ -9893,6 +9899,9 @@ static int doNativeMigrate(struct qemud_driver
*driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     unsigned int background_flags = 0;

+    virCheckFlags(VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC,
+                  -1);
+
     /* Issue the migrate command. */
     if (STRPREFIX(uri, "tcp:") && !STRPREFIX(uri, "tcp://")) {
         /* HACK: source host generates bogus URIs, so fix them up */
@@ -9925,7 +9934,8 @@ static int doNativeMigrate(struct qemud_driver
*driver,
     if (flags & VIR_MIGRATE_NON_SHARED_INC)
         background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;

-    if (qemuMonitorMigrateToHost(priv->mon, background_flags,
uribits->server, uribits->port) < 0) {
+    if (qemuMonitorMigrateToHost(priv->mon, background_flags,
uribits->server,
+                                 uribits->port) < 0) {
         qemuDomainObjExitMonitorWithDriver(driver, vm);
         goto cleanup;
     }
@@ -10011,6 +10021,7 @@ static int doTunnelMigrate(virDomainPtr dom,
     int status;
     unsigned long long transferred, remaining, total;
     unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
+
     /*
      * The order of operations is important here to avoid touching
      * the source VM until we are very sure we can successfully
@@ -10100,7 +10111,8 @@ static int doTunnelMigrate(virDomainPtr dom,
     if (flags & VIR_MIGRATE_NON_SHARED_INC)
         background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
     if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX){
-        internalret = qemuMonitorMigrateToUnix(priv->mon,
background_flags, unixfile);
+        internalret = qemuMonitorMigrateToUnix(priv->mon, background_flags,
+                                               unixfile);
     }
     else if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC) {
         const char *args[] = { "nc", "-U", unixfile, NULL };
diff --git i/src/qemu/qemu_monitor_text.c w/src/qemu/qemu_monitor_text.c
index ff79663..3119600 100644
--- i/src/qemu/qemu_monitor_text.c
+++ w/src/qemu/qemu_monitor_text.c
@@ -1139,7 +1139,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
         virReportOOMError();
         return -1;
     }
-    virBufferAddLit(&extra, " ");
+
     if (background & QEMU_MONITOR_MIGRATE_BACKGROUND)
         virBufferAddLit(&extra, " -d");
     if (background & QEMU_MONITOR_MIGRATE_NON_SHARED_DISK)


Then I verified that it passes 'make check' and 'make syntax-check', and
finally pushed this in your name.  Thanks again for the contribution,
and for the reminders to review it.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100504/ae2edcf8/attachment-0001.sig>


More information about the libvir-list mailing list