From c906496415793beb9d89ddc0eb76be7b2b22e93a Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 29 Feb 2008 16:32:39 +0000
Subject: [PATCH] Fix master role stop on cluster destroy

Currently the cluster destroy doesn't remove the master role, which
means that the IP address of the cluster remains assigned to the master
node.

This patch fixes this and also a docstring in backend.StopMaster().

Reviewed-by: imsnah
---
 lib/backend.py | 4 +---
 lib/cmdlib.py  | 2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index 608862aa2..ab03e76e2 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -64,9 +64,7 @@ def StartMaster():
 def StopMaster():
   """Deactivate this node as master.
 
-  This does two things:
-    - run the master stop script
-    - remove link to master cron script.
+  This runs the master stop script.
 
   """
   result = utils.RunCmd([constants.MASTER_SCRIPT, "-d", "stop"])
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 10ee633ba..1c5356e60 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -632,6 +632,8 @@ class LUDestroyCluster(NoHooksLU):
 
     """
     master = self.sstore.GetMasterNode()
+    if not rpc.call_node_stop_master(master):
+      raise errors.OpExecError("Could not disable the master role")
     priv_key, pub_key, _ = ssh.GetUserFiles(constants.GANETI_RUNAS)
     utils.CreateBackup(priv_key)
     utils.CreateBackup(pub_key)
-- 
GitLab