From f11154549e0a5ebbf8e71102c743c021b616da39 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Fri, 19 Feb 2010 12:20:59 +0000
Subject: [PATCH] Abstract starting the node daemons

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 | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher
index 9a2a2a8e0..351f4d83b 100755
--- a/daemons/ganeti-watcher
+++ b/daemons/ganeti-watcher
@@ -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:
-- 
GitLab