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

[Xen-changelog] [xen master] xl: remus/colo: only initialise ha variable when necessary



commit 9b394b7eff681fc1b4c88d9dec88ed38ebf8c456
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Jun 6 11:52:07 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Jun 14 16:22:15 2016 +0100

    xl: remus/colo: only initialise ha variable when necessary
    
    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@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8696ca7..70d3fd9 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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