From 31684f840bb8b321e958db75c6c8cd96a606ca28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Wed, 15 Sep 2010 14:25:49 +0200
Subject: [PATCH] Stop all daemons precautiosly before trying to start
 ganeti-noded again
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Please note that if the pid file is broken or missing we'll not catch
the process (if any is running) and it's up to the user to fix this state

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/bootstrap.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bootstrap.py b/lib/bootstrap.py
index eca334914..889fa7118 100644
--- a/lib/bootstrap.py
+++ b/lib/bootstrap.py
@@ -530,8 +530,10 @@ def SetupNodeDaemon(cluster_name, node, ssh_key_check):
   sshrunner.CopyFileToNode(node, constants.NODED_CERT_FILE)
   sshrunner.CopyFileToNode(node, constants.RAPI_CERT_FILE)
   sshrunner.CopyFileToNode(node, constants.CONFD_HMAC_KEY)
-  mycommand = ("%s start %s -b '%s'" % (constants.DAEMON_UTIL, constants.NODED,
-                                        bind_address))
+  mycommand = ("%s stop-all; %s start %s -b '%s'" % (constants.DAEMON_UTIL,
+                                                     constants.DAEMON_UTIL,
+                                                     constants.NODED,
+                                                     bind_address))
 
   result = sshrunner.Run(node, 'root', mycommand, batch=False,
                          ask_key=ssh_key_check,
-- 
GitLab