Commit 41e079ce authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Explicitly pass params to change_master_netmask



Make the master explicitly pass the parameters to the
change_master_netmask RPC, and change all the call flow to use the new
interface.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 96e0d5cc
...@@ -412,11 +412,15 @@ def StopMasterDaemons(): ...@@ -412,11 +412,15 @@ def StopMasterDaemons():
result.cmd, result.exit_code, result.output) result.cmd, result.exit_code, result.output)
def ChangeMasterNetmask(netmask): def ChangeMasterNetmask(old_netmask, netmask, master_ip, master_netdev):
"""Change the netmask of the master IP. """Change the netmask of the master IP.
@param old_netmask: the old value of the netmask
@param netmask: the new value of the netmask
@param master_ip: the master IP
@param master_netdev: the master network device
""" """
master_netdev, master_ip, _, _, old_netmask = GetMasterInfo()
if old_netmask == netmask: if old_netmask == netmask:
return return
......
...@@ -3710,10 +3710,11 @@ class LUClusterSetParams(LogicalUnit): ...@@ -3710,10 +3710,11 @@ class LUClusterSetParams(LogicalUnit):
self.cluster.master_netdev = self.op.master_netdev self.cluster.master_netdev = self.op.master_netdev
if self.op.master_netmask: if self.op.master_netmask:
master = self.cfg.GetMasterNode() (master, ip, dev, old_netmask, _) = self.cfg.GetMasterNetworkParameters()
feedback_fn("Changing master IP netmask to %s" % self.op.master_netmask) feedback_fn("Changing master IP netmask to %s" % self.op.master_netmask)
result = self.rpc.call_node_change_master_netmask(master, result = self.rpc.call_node_change_master_netmask(master, old_netmask,
self.op.master_netmask) self.op.master_netmask,
ip, dev)
if result.fail_msg: if result.fail_msg:
msg = "Could not change the master IP netmask: %s" % result.fail_msg msg = "Could not change the master IP netmask: %s" % result.fail_msg
self.LogWarning(msg) self.LogWarning(msg)
......
...@@ -414,7 +414,10 @@ CALLS = { ...@@ -414,7 +414,10 @@ CALLS = {
], None, ], None,
"Deactivates master IP on a node"), "Deactivates master IP on a node"),
("node_change_master_netmask", SINGLE, TMO_FAST, [ ("node_change_master_netmask", SINGLE, TMO_FAST, [
("netmask", None, None), ("old_netmask", None, "The old value of the netmask"),
("netmask", None, "The new value of the netmask"),
("master_ip", None, "The master IP"),
("master_netdev", None, "The master network device"),
], None, "Change master IP netmask"), ], None, "Change master IP netmask"),
("node_leave_cluster", SINGLE, TMO_NORMAL, [ ("node_leave_cluster", SINGLE, TMO_NORMAL, [
("modify_ssh_setup", None, None), ("modify_ssh_setup", None, None),
......
...@@ -718,7 +718,8 @@ class NodeHttpServer(http.server.HttpServer): ...@@ -718,7 +718,8 @@ class NodeHttpServer(http.server.HttpServer):
"""Change the master IP netmask. """Change the master IP netmask.
""" """
return backend.ChangeMasterNetmask(params[0]) return backend.ChangeMasterNetmask(params[0], params[1], params[2],
params[3])
@staticmethod @staticmethod
def perspective_node_leave_cluster(params): def perspective_node_leave_cluster(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