Commit 7c74bbe0 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Change the semantics of stop_master RPC



To avoid polluting the stop_master RPC interface with network
parameters, this patch removes the deactivation of the master IP from
this RPC.

The call to deactivate_master_ip is then added before every stop_master
call.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 8da2bd43
......@@ -565,12 +565,19 @@ def FinalizeClusterDestroy(master):
"""
cfg = config.ConfigWriter()
modify_ssh_setup = cfg.GetClusterInfo().modify_ssh_setup
result = rpc.BootstrapRunner().call_node_stop_master(master)
runner = rpc.BootstrapRunner()
result = runner.call_node_deactivate_master_ip(master)
msg = result.fail_msg
if msg:
logging.warning("Could not disable the master IP: %s", msg)
result = runner.call_node_stop_master(master)
msg = result.fail_msg
if msg:
logging.warning("Could not disable the master role: %s", msg)
result = rpc.BootstrapRunner().call_node_leave_cluster(master,
modify_ssh_setup)
result = runner.call_node_leave_cluster(master, modify_ssh_setup)
msg = result.fail_msg
if msg:
logging.warning("Could not shutdown the node daemon and cleanup"
......@@ -698,7 +705,13 @@ def MasterFailover(no_voting=False):
logging.info("Stopping the master daemon on node %s", old_master)
result = rpc.BootstrapRunner().call_node_stop_master(old_master)
runner = rpc.BootstrapRunner()
result = runner.call_node_deactivate_master_ip(old_master)
msg = result.fail_msg
if msg:
logging.warning("Could not disable the master IP: %s", msg)
result = runner.call_node_stop_master(old_master)
msg = result.fail_msg
if msg:
logging.error("Could not disable the master role on the old master"
......
......@@ -708,13 +708,9 @@ class NodeHttpServer(http.server.HttpServer):
@staticmethod
def perspective_node_stop_master(params):
"""Deactivate the master IP and stops master daemons on this node.
Sometimes both operations need to be executed at the same time (doing one of
the two would make impossible to do the other one).
"""Stops master daemons on this node.
"""
backend.DeactivateMasterIp()
return backend.StopMasterDaemons()
@staticmethod
......
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