Abstract starting the node daemons
authorGuido Trotter <ultrotter@google.com>
Fri, 19 Feb 2010 12:20:59 +0000 (12:20 +0000)
committerGuido Trotter <ultrotter@google.com>
Fri, 26 Feb 2010 12:24:01 +0000 (13:24 +0100)
We're using a separate function for this, as we're going to add some
functionality to this feature.

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

daemons/ganeti-watcher

index 9a2a2a8..351f4d8 100755 (executable)
@@ -84,6 +84,16 @@ def EnsureDaemon(name):
   return True
 
 
+def StartNodeDaemons():
+  """Start all the daemons that should be running on all nodes.
+
+  """
+  # on master or not, try to start the node dameon
+  EnsureDaemon(constants.NODED)
+  # start confd as well. On non candidates it will be in disabled mode.
+  EnsureDaemon(constants.CONFD)
+
+
 class WatcherState(object):
   """Interface to a state file recording restart attempts.
 
@@ -477,10 +487,7 @@ def main():
 
   update_file = False
   try:
-    # on master or not, try to start the node dameon
-    EnsureDaemon(constants.NODED)
-    # start confd as well. On non candidates it will be in disabled mode.
-    EnsureDaemon(constants.CONFD)
+    StartNodeDaemons()
 
     notepad = WatcherState()
     try: