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

[Xen-devel] [PATCH RFC v2 7/8] Fixed bugs in the migration flow



---
 tools/libxc/xc_sr_save.c         |  1 -
 tools/libxl/libxl_create.c       | 15 ++++++++-------
 tools/libxl/libxl_dom_save.c     |  2 +-
 tools/libxl/libxl_domain.c       |  2 +-
 tools/libxl/libxl_internal.h     |  2 +-
 tools/libxl/libxl_save_callout.c |  5 +++--
 tools/libxl/libxl_stream_write.c |  2 +-
 tools/xl/xl.h                    |  2 +-
 tools/xl/xl_cmdtable.c           |  3 ++-
 tools/xl/xl_migrate.c            |  2 +-
 10 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index 181a0c8..f3e162f 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -464,7 +464,6 @@ static int send_virtual_devices_and_params(struct 
xc_sr_context *ctx)
     uint64_t i = 0;
     int rc = 0;
 
-    fprintf(stderr, "BRUNO: SEND VIRTUAL DEVICES AND PARAMS\n");
     xc_set_progress_prefix(xch, "Frames");
 
     //FOR RTL AND VGA IN 128MB VM . Might change on size of VM
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 6df2754..0579671 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1055,24 +1055,24 @@ static void start_nbd_server(libxl__egc *egc, 
libxl__dm_spawn_state *dmss,
               * TODO: Assign port dynamically
               */
 
-            LOGD(DEBUG, "Starting NBD Server\n");
+            LOGD(DEBUG, domid, "Starting NBD Server\n");
             ret = libxl__qmp_nbd_server_start(gc, domid, "::", 
QEMU_DRIVE_MIRROR_PORT);
             if (ret) {
                 ret = ERROR_FAIL;
-                LOGD(ERROR, "Failed to start NBD Server\n");
+                LOGD(ERROR, domid, "Failed to start NBD Server\n");
                 goto skip_nbd;
             }else{
-                LOGD(INFO, "Started NBD Server Successfully\n");
+                LOGD(INFO, domid, "Started NBD Server Successfully\n");
             }
 
             ret = libxl__qmp_nbd_server_add(gc, domid, 
QEMU_DRIVE_MIRROR_DEVICE);
 
             if (ret) {
                 ret = ERROR_FAIL;
-                LOGD(ERROR, "Failed to add NBD Server\n");
+                LOGD(ERROR, domid, "Failed to add NBD Server\n");
                 goto skip_nbd;
             } else {
-                LOGD(INFO, "NBD Add Successful\n");
+                LOGD(INFO, domid, "NBD Add Successful\n");
             }
         }
 
@@ -1103,7 +1103,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,
     libxl__srm_restore_autogen_callbacks *const callbacks =
         &dcs->srs.shs.callbacks.restore.a;
     libxl__srm_restore_autogen_callbacks *const callbacks_mirror_qemu_disks =
-        &dcs->srs_local_disks.shs.callbacks.restore.a;
+        &dcs->srs_mirror_qemu_disks.shs.callbacks.restore.a;
 
     if (rc) {
         domcreate_rebuild_done(egc, dcs, rc);
@@ -1252,6 +1252,7 @@ static void domcreate_stream_done(libxl__egc *egc,
 {
     libxl__domain_create_state *dcs = srs->dcs;
     STATE_AO_GC(dcs->ao);
+    int rc;
 
     const uint32_t domid = dcs->guest_domid;
     const char* uri;
@@ -1269,7 +1270,7 @@ static void domcreate_stream_done(libxl__egc *egc,
         }else{
             fprintf(stderr, "Stopped NBD server successfully\n");
         }
-        uri = GCSPRINTF("exec: /bin/cat %s", 
(&dcs->sdss.dm)->build_state->saved_state);
+        uri = GCSPRINTF("exec: /bin/cat %s", state_file);
         libxl__qmp_migrate_incoming(gc, domid, uri);
         domcreate_devmodel_started(egc, &dcs->sdss.dm, 0);
     }
diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c
index a2730f5..ddfe2f8 100644
--- a/tools/libxl/libxl_dom_save.c
+++ b/tools/libxl/libxl_dom_save.c
@@ -446,7 +446,7 @@ static void mirror_qemu_disks(libxl__egc *egc, 
libxl__stream_write_state *sws,
 start_mirror:
         LOGD(DEBUG, domid, "Sleeping for a bit so that source can start 
NBD\n");
         sleep(30);
-        LOGD(DEBUG, "Starting mirror-drive of device %s\n",
+        LOGD(DEBUG, domid, "Starting mirror-drive of device %s\n",
              QEMU_DRIVE_MIRROR_DEVICE);
         target = GCSPRINTF("nbd:%s:%s:exportname=%s", dss->hostname,
                            QEMU_DRIVE_MIRROR_PORT, QEMU_DRIVE_MIRROR_DEVICE);
diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index 76c6d3d..9b512b9 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -509,7 +509,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, 
int fd, int flags,
     dss->type = type;
     dss->live = flags & LIBXL_SUSPEND_LIVE;
     dss->debug = flags & LIBXL_SUSPEND_DEBUG;
-    dss->mirror_qemu_disks = flags & LIBXL_SUSPEND_MIRROR_QEMU_DISKS;
+    dss->mirror_qemu_disks = (flags & LIBXL_SUSPEND_MIRROR_QEMU_DISKS) ? 1 : 0;
     dss->hostname = hostname;
     dss->checkpointed_stream = LIBXL_CHECKPOINTED_STREAM_NONE;
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 30862c6..d7b338b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3759,7 +3759,7 @@ struct libxl__domain_create_state {
         /* If we're not doing stubdom, we use only dmss.dm,
          * for the non-stubdom device model. */
     libxl__stream_read_state srs;
-    libxl__stream_read_state srs_local_disks;
+    libxl__stream_read_state srs_mirror_qemu_disks;
     /* necessary if the domain creation failed and we have to destroy it */
     libxl__domain_destroy_state dds;
     libxl__multidev multidev;
diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c
index 48f96d8..64c891a 100644
--- a/tools/libxl/libxl_save_callout.c
+++ b/tools/libxl/libxl_save_callout.c
@@ -62,7 +62,8 @@ void libxl__xc_domain_restore(libxl__egc *egc, 
libxl__domain_create_state *dcs,
         state->store_domid, state->console_port,
         state->console_domid,
         hvm, pae,
-        cbflags, dcs->restore_params.checkpointed_stream
+        cbflags, dcs->restore_params.checkpointed_stream,
+        migration_phase,
     };
 
     shs->ao = ao;
@@ -74,7 +75,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, 
libxl__domain_create_state *dcs,
     } else {
         if ( migration_phase != LIBXL_MIGRATION_PHASE_MIRROR_DISK ) {
             shs->completion_callback = libxl__xc_domain_restore_done;
-            if( local_disks == LIBXL_MIGRATION_PHASE_VIRTUAL_RAM )
+            if( migration_phase == LIBXL_MIGRATION_PHASE_VIRTUAL_RAM )
                 shs->need_results = 0;
             else
                 shs->need_results = 1;
diff --git a/tools/libxl/libxl_stream_write.c b/tools/libxl/libxl_stream_write.c
index ad312ed..f5269f4 100644
--- a/tools/libxl/libxl_stream_write.c
+++ b/tools/libxl/libxl_stream_write.c
@@ -335,7 +335,7 @@ static void stream_header_done(libxl__egc *egc,
 static void libxc_header_done(libxl__egc *egc,
                               libxl__stream_write_state *stream)
 {
-    int save_mirror_qemu_disks = stream->dss->local_disks;
+    int save_mirror_qemu_disks = stream->dss->mirror_qemu_disks;
     libxl__xc_domain_save(egc, stream->dss, &stream->shs,
                           save_mirror_qemu_disks + stream->mirror_qemu_disks);
 }
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 070bac1..2bff52f 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -35,7 +35,7 @@ struct domain_create {
     int daemonize;
     int monitor; /* handle guest reboots etc */
     int paused;
-    int mirror_qemu_disk;
+    int mirror_qemu_disks;
     int dryrun;
     int quiet;
     int vnc;
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 5cfc7e8..5fa5720 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -165,7 +165,8 @@ struct cmd_spec cmd_table[] = {
       "-e              Do not wait in the background (on <host>) for the 
death\n"
       "                of the domain.\n"
       "--debug         Print huge (!) amount of debug during the migration 
process.\n"
-      "-p              Do not unpause domain after migrating it."
+      "-p              Do not unpause domain after migrating it.\n"
+      "-q              Migrate local disks (Copy all the storage)"
     },
     { "restore",
       &main_restore, 0, 1,
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index 9f43d96..0a01cad 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -610,7 +610,7 @@ int main_migrate(int argc, char **argv)
                   daemonize ? "" : " -e",
                   debug ? " -d" : "",
                   pause_after_migration ? " -p" : "",
-                  mirror_qemu_disks ? "-q" :"");
+                  mirror_qemu_disks ? " -q" : "");
     }
 
     migrate_domain(domid, rune, debug, config_filename, mirror_qemu_disks,
-- 
2.3.2 (Apple Git-55)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.