Commit 6c00d19a authored by Iustin Pop's avatar Iustin Pop

Convert node_stop_master rpc to new style result

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent b726aff0
......@@ -240,9 +240,11 @@ def StopMaster(stop_daemons):
@rtype: None
"""
# TODO: log and report back to the caller the error failures; we
# need to decide in which case we fail the RPC for this
master_netdev, master_ip, _ = GetMasterInfo()
if not master_netdev:
return False
return False, "Cluster configuration incomplete, cannot read ssconf files"
result = utils.RunCmd(["ip", "address", "del", "%s/32" % master_ip,
"dev", master_netdev])
......@@ -255,7 +257,7 @@ def StopMaster(stop_daemons):
for daemon in constants.RAPI_PID, constants.MASTERD_PID:
utils.KillProcess(utils.ReadPidFile(utils.DaemonPidFileName(daemon)))
return True
return True, None
def AddNode(dsa, dsapub, rsa, rsapub, sshkey, sshpub):
......
......@@ -318,8 +318,9 @@ def FinalizeClusterDestroy(master):
"""
result = rpc.RpcRunner.call_node_stop_master(master, True)
if result.failed or not result.data:
logging.warning("Could not disable the master role")
msg = result.RemoteFailMsg()
if msg:
logging.warning("Could not disable the master role: %s" % msg)
result = rpc.RpcRunner.call_node_leave_cluster(master)
if result.failed or not result.data:
logging.warning("Could not shutdown the node daemon and cleanup the node")
......@@ -428,9 +429,10 @@ def MasterFailover():
logging.info("Setting master to %s, old master: %s", new_master, old_master)
result = rpc.RpcRunner.call_node_stop_master(old_master, True)
if result.failed or not result.data:
msg = result.RemoteFailMsg()
if msg:
logging.error("Could not disable the master role on the old master"
" %s, please disable manually", old_master)
" %s, please disable manually: %s", old_master, msg)
# Here we have a phase where no master should be running
......
......@@ -656,9 +656,9 @@ class LUDestroyCluster(NoHooksLU):
"""
master = self.cfg.GetMasterNode()
result = self.rpc.call_node_stop_master(master, False)
result.Raise()
if not result.data:
raise errors.OpExecError("Could not disable the master role")
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Could not disable the master role: %s" % msg)
priv_key, pub_key, _ = ssh.GetUserFiles(constants.GANETI_RUNAS)
utils.CreateBackup(priv_key)
utils.CreateBackup(pub_key)
......@@ -1398,8 +1398,9 @@ class LURenameCluster(LogicalUnit):
# shutdown the master IP
master = self.cfg.GetMasterNode()
result = self.rpc.call_node_stop_master(master, False)
if result.failed or not result.data:
raise errors.OpExecError("Could not disable the master role")
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Could not disable the master role: %s" % msg)
try:
cluster = self.cfg.GetClusterInfo()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment