From 3141ad3bab94e4ddcaa1236509766dd52f918400 Mon Sep 17 00:00:00 2001
From: Luca Bigliardi <shammash@google.com>
Date: Tue, 25 Aug 2009 16:19:47 +0100
Subject: [PATCH] LUDestroyCluster: run hooks

Run post hooks on master node before it's removed.

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/cmdlib.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 796df893c..b4dd1bd03 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -836,6 +836,14 @@ class LUDestroyCluster(LogicalUnit):
 
     """
     master = self.cfg.GetMasterNode()
+
+    # Run post hooks on master node before it's removed
+    hm = self.proc.hmclass(self.rpc.call_hooks_runner, self)
+    try:
+      hm.RunPhase(constants.HOOKS_PHASE_POST, [master])
+    except:
+      self.LogWarning("Errors occurred running hooks on %s" % master)
+
     result = self.rpc.call_node_stop_master(master, False)
     result.Raise("Could not disable the master role")
     priv_key, pub_key, _ = ssh.GetUserFiles(constants.GANETI_RUNAS)
-- 
GitLab