Commit 91ae95fd authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Uniform master IP activation and deactivation



Add the master IP family parameter to the master IP deactivation RPCs,
so that the activation and deactivation interfaces are uniform.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent ef9fa5b9
......@@ -375,14 +375,16 @@ def StartMasterDaemons(no_voting):
@RunLocalHooks(constants.FAKE_OP_MASTER_TURNDOWN, "master-ip-turndown",
_BuildMasterIpEnv)
def DeactivateMasterIp(master_ip, master_netmask, master_netdev):
def DeactivateMasterIp(master_ip, master_netmask, master_netdev, family):
"""Deactivate the master IP on this node.
@param master_ip: the master IP
@param master_netmask: the master IP netmask
@param master_netdev: the master network device
@param family: the IP family
"""
# pylint: disable=W0613
# TODO: log and report back to the caller the error failures; we
# need to decide in which case we fail the RPC for this
......
......@@ -567,8 +567,9 @@ def FinalizeClusterDestroy(master):
modify_ssh_setup = cfg.GetClusterInfo().modify_ssh_setup
runner = rpc.BootstrapRunner()
(_, ip, netdev, netmask, _) = cfg.GetMasterNetworkParameters()
result = runner.call_node_deactivate_master_ip(master, ip, netmask, netdev)
(_, ip, netdev, netmask, family) = cfg.GetMasterNetworkParameters()
result = runner.call_node_deactivate_master_ip(master, ip, netmask, netdev,
family)
msg = result.fail_msg
if msg:
logging.warning("Could not disable the master IP: %s", msg)
......@@ -707,9 +708,9 @@ def MasterFailover(no_voting=False):
logging.info("Stopping the master daemon on node %s", old_master)
runner = rpc.BootstrapRunner()
(_, ip, netdev, netmask, _) = cfg.GetMasterNetworkParameters()
(_, ip, netdev, netmask, family) = cfg.GetMasterNetworkParameters()
result = runner.call_node_deactivate_master_ip(old_master, ip, netmask,
netdev)
netdev, family)
msg = result.fail_msg
if msg:
logging.warning("Could not disable the master IP: %s", msg)
......
......@@ -1355,12 +1355,13 @@ class LUClusterDestroy(LogicalUnit):
"""Destroys the cluster.
"""
(master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
(master, ip, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
# Run post hooks on master node before it's removed
_RunPostHook(self, master)
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev,
family)
result.Raise("Could not disable the master role")
return master
......@@ -3327,7 +3328,8 @@ class LUClusterRename(LogicalUnit):
# shutdown the master IP
(master, ip, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev,
family)
result.Raise("Could not disable the master role")
try:
......@@ -3700,10 +3702,11 @@ class LUClusterSetParams(LogicalUnit):
helper_os("blacklisted_os", self.op.blacklisted_os, "blacklisted")
if self.op.master_netdev:
(master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
(master, ip, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
feedback_fn("Shutting down master ip on the current netdev (%s)" %
self.cluster.master_netdev)
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
result = self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev,
family)
result.Raise("Could not disable the master ip")
feedback_fn("Changing master_netdev from %s to %s" %
(dev, self.op.master_netdev))
......@@ -3903,8 +3906,8 @@ class LUClusterDeactivateMasterIp(NoHooksLU):
"""Deactivate the master IP.
"""
(master, ip, dev, netmask, _) = self.cfg.GetMasterNetworkParameters()
self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev)
(master, ip, dev, netmask, family) = self.cfg.GetMasterNetworkParameters()
self.rpc.call_node_deactivate_master_ip(master, ip, netmask, dev, family)
def _WaitForSync(lu, instance, disks=None, oneshot=False):
......
......@@ -411,6 +411,7 @@ CALLS = {
("master_ip", None, "The master IP"),
("master_netmask", None, "The master IP netmask"),
("master_netdev", None, "The master network device"),
("ip_family", None, "The cluster IP family"),
], None,
"Deactivates master IP on a node"),
("node_change_master_netmask", SINGLE, TMO_FAST, [
......
......@@ -704,7 +704,8 @@ class NodeHttpServer(http.server.HttpServer):
"""Deactivate the master IP on this node.
"""
return backend.DeactivateMasterIp(params[0], params[1], params[2])
return backend.DeactivateMasterIp(params[0], params[1], params[2],
params[3])
@staticmethod
def perspective_node_stop_master(params):
......
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