Fix burnin problems when using http checks
[ganeti-local] / daemons / ganeti-masterd
index 538a0ff..ac0af6d 100755 (executable)
@@ -89,9 +89,8 @@ class IOServer(SocketServer.UnixStreamServer):
   def __init__(self, address, rqhandler):
     """IOServer constructor
 
-    Args:
-      address: the address to bind this IOServer to
-      rqhandler: RequestHandler type object
+    @param address: the address to bind this IOServer to
+    @param rqhandler: RequestHandler type object
 
     """
     SocketServer.UnixStreamServer.__init__(self, address, rqhandler)
@@ -222,8 +221,8 @@ class ClientOps:
       return queue.ArchiveJob(job_id)
 
     elif method == luxi.REQ_AUTOARCHIVE_JOBS:
-      age = args
-      return queue.AutoArchiveJobs(age)
+      (age, timeout) = args
+      return queue.AutoArchiveJobs(age, timeout)
 
     elif method == luxi.REQ_WAIT_FOR_JOB_CHANGE:
       (job_id, fields, prev_job_info, prev_log_serial, timeout) = args
@@ -348,8 +347,7 @@ class GanetiContext(object):
 def ParseOptions():
   """Parse the command line options.
 
-  Returns:
-    (options, args) as from OptionParser.parse_args()
+  @return: (options, args) as from OptionParser.parse_args()
 
   """
   parser = OptionParser(description="Ganeti master daemon",
@@ -404,16 +402,17 @@ def CheckAgreement():
       continue
     break
   if retries == 0:
-      logging.critical("Cluster inconsistent, most of the nodes didn't answer"
-                       " after multiple retries. Aborting startup")
-      return False
+    logging.critical("Cluster inconsistent, most of the nodes didn't answer"
+                     " after multiple retries. Aborting startup")
+    return False
   # here a real node is at the top of the list
   all_votes = sum(item[1] for item in votes)
   top_node, top_votes = votes[0]
   result = False
   if top_node != myself:
     logging.critical("It seems we are not the master (top-voted node"
-                     " is %s)", top_node)
+                     " is %s with %d out of %d votes)", top_node, top_votes,
+                     all_votes)
   elif top_votes < all_votes - top_votes:
     logging.critical("It seems we are not the master (%d votes for,"
                      " %d votes against)", top_votes, all_votes - top_votes)
@@ -430,6 +429,9 @@ def main():
   utils.debug = options.debug
   utils.no_fork = True
 
+  if options.fork:
+    utils.CloseFDs()
+
   rpc.Init()
   try:
     ssconf.CheckMaster(options.debug)
@@ -461,8 +463,7 @@ def main():
 
   # become a daemon
   if options.fork:
-    utils.Daemonize(logfile=constants.LOG_MASTERDAEMON,
-                    noclose_fds=[master.fileno()])
+    utils.Daemonize(logfile=constants.LOG_MASTERDAEMON)
 
   utils.WritePidFile(constants.MASTERD_PID)
   try: