]> xenbits.xensource.com Git - xen.git/commitdiff
xl: remus/colo: only initialise ha variable when necessary
authorWei Liu <wei.liu2@citrix.com>
Mon, 6 Jun 2016 10:52:07 +0000 (11:52 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 14 Jun 2016 15:22:15 +0000 (16:22 +0100)
The original code is wrong because the common case is no HA enabled.  It
should have been set to NULL first.

Instead of setting ha to NULL, move it to the scope where it is used.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c

index 8696ca702b63f68930a2acace0f03a40c4ac9e0d..70d3fd9fc77b322c1b33807e44d2d66ac5e1591a 100644 (file)
@@ -4788,8 +4788,6 @@ static void migrate_receive(int debug, int daemonize, int monitor,
     char rc_buf;
     char *migration_domname;
     struct domain_create dom_info;
-    const char *ha = checkpointed == LIBXL_CHECKPOINTED_STREAM_COLO ?
-                     "COLO" : "Remus";
 
     signal(SIGPIPE, SIG_IGN);
     /* if we get SIGPIPE we'd rather just have it as an error */
@@ -4824,6 +4822,9 @@ static void migrate_receive(int debug, int daemonize, int monitor,
     switch (checkpointed) {
     case LIBXL_CHECKPOINTED_STREAM_REMUS:
     case LIBXL_CHECKPOINTED_STREAM_COLO:
+    {
+        const char *ha = checkpointed == LIBXL_CHECKPOINTED_STREAM_COLO ?
+                         "COLO" : "Remus";
         /* If we are here, it means that the sender (primary) has crashed.
          * TODO: Split-Brain Check.
          */
@@ -4860,6 +4861,7 @@ static void migrate_receive(int debug, int daemonize, int monitor,
                     ha, common_domname, domid, rc);
 
         exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
+    }
     default:
         /* do nothing */
         break;