From 2a6de57ad4a55c4f1f1de19c79bd457ffde37ce1 Mon Sep 17 00:00:00 2001
From: Andrea Spadaccini <spadaccio@google.com>
Date: Tue, 1 Nov 2011 14:15:05 +0000
Subject: [PATCH] Check the results of master IP RPCs

A failed gnt-cluster (de)activate-master-ip would not produce any output
to the user. This patch adds code that checks for the results of the
RPCs and raise an exception if appropriate.

Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/cmdlib.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index defd60d5d..3b445cefe 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3858,7 +3858,8 @@ class LUClusterActivateMasterIp(NoHooksLU):
 
     """
     master = self.cfg.GetMasterNode()
-    self.rpc.call_node_activate_master_ip(master)
+    result = self.rpc.call_node_activate_master_ip(master)
+    result.Raise("Could not activate the master IP")
 
 
 class LUClusterDeactivateMasterIp(NoHooksLU):
@@ -3870,7 +3871,8 @@ class LUClusterDeactivateMasterIp(NoHooksLU):
 
     """
     master = self.cfg.GetMasterNode()
-    self.rpc.call_node_deactivate_master_ip(master)
+    result = self.rpc.call_node_deactivate_master_ip(master)
+    result.Raise("Could not deactivate the master IP")
 
 
 def _WaitForSync(lu, instance, disks=None, oneshot=False):
-- 
GitLab