Fix master IP activation in failover with no-voting
authorIustin Pop <iustin@google.com>
Tue, 19 Apr 2011 16:35:13 +0000 (18:35 +0200)
committerIustin Pop <iustin@google.com>
Tue, 19 Apr 2011 16:41:29 +0000 (18:41 +0200)
Thanks to net.for.hub@gmail.com for reporting this. The logic in
masterd.CheckMasterd did an early return in case of no_voting, hence
skipping the master IP activation. We just change the ifs to not
return but simply continue through the function.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/server/masterd.py

index 72b1466..aa56df8 100644 (file)
@@ -578,26 +578,24 @@ def CheckMasterd(options, args):
   # If CheckMaster didn't fail we believe we are the master, but we have to
   # confirm with the other nodes.
   if options.no_voting:
-    if options.yes_do_it:
-      return
+    if not options.yes_do_it:
+      sys.stdout.write("The 'no voting' option has been selected.\n")
+      sys.stdout.write("This is dangerous, please confirm by"
+                       " typing uppercase 'yes': ")
+      sys.stdout.flush()
 
-    sys.stdout.write("The 'no voting' option has been selected.\n")
-    sys.stdout.write("This is dangerous, please confirm by"
-                     " typing uppercase 'yes': ")
-    sys.stdout.flush()
+      confirmation = sys.stdin.readline().strip()
+      if confirmation != "YES":
+        print >> sys.stderr, "Aborting."
+        sys.exit(constants.EXIT_FAILURE)
 
-    confirmation = sys.stdin.readline().strip()
-    if confirmation != "YES":
-      print >> sys.stderr, "Aborting."
+  else:
+    # CheckAgreement uses RPC and threads, hence it needs to be run in
+    # a separate process before we call utils.Daemonize in the current
+    # process.
+    if not utils.RunInSeparateProcess(CheckAgreement):
       sys.exit(constants.EXIT_FAILURE)
 
-    return
-
-  # CheckAgreement uses RPC and threads, hence it needs to be run in a separate
-  # process before we call utils.Daemonize in the current process.
-  if not utils.RunInSeparateProcess(CheckAgreement):
-    sys.exit(constants.EXIT_FAILURE)
-
   # ActivateMasterIP also uses RPC/threads, so we run it again via a
   # separate process.