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

[libvirt] [PATCH] Fix up basic migration.



Basic live migration was broken by the commit that added
non-shared block support.  It also added a couple of
built-in memory leaks.  This patch fixes these problems
and allows normal live migration to work again.

Signed-off-by: Chris Lalancette <clalance redhat com>
---
 src/qemu/qemu_driver.c       |    3 ---
 src/qemu/qemu_monitor_text.c |   10 +++++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cfa5964..bbab893 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10205,9 +10205,6 @@ 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 */
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 3df078a..41a1fab 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1134,6 +1134,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
     int ret = -1;
     char *safedest = qemuMonitorEscapeArg(dest);
     virBuffer extra = VIR_BUFFER_INITIALIZER;
+    char *extrastr = NULL;
 
     if (!safedest) {
         virReportOOMError();
@@ -1149,10 +1150,12 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
     if (virBufferError(&extra)) {
         virBufferFreeAndReset(&extra);
         virReportOOMError();
-        free(safedest);
-        return -1;
+        goto cleanup;
     }
-    if (virAsprintf(&cmd, "migrate %s\"%s\"", virBufferContentAndReset(&extra), safedest) < 0) {
+
+    extrastr = virBufferContentAndReset(&extra);
+    if (virAsprintf(&cmd, "migrate %s\"%s\"", extra ? extrastr : "",
+                    safedest) < 0) {
         virReportOOMError();
         goto cleanup;
     }
@@ -1181,6 +1184,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
     ret = 0;
 
 cleanup:
+    VIR_FREE(extrastr);
     VIR_FREE(safedest);
     VIR_FREE(info);
     VIR_FREE(cmd);
-- 
1.6.6.1


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