Commit 909b3a0e authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Restore backend.GetMasterInfo return values order

Change 5a8648eb

 changed the order of the
return values of backend.GetMasterInfo(). This broke the users of the
master_info RPC.

This change restores the original order, and adds a comment in
bootstrap.py about the new value added to the return values of
master_info.
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 5a8648eb
...@@ -231,8 +231,8 @@ def GetMasterInfo(): ...@@ -231,8 +231,8 @@ def GetMasterInfo():
for consumption here or from the node daemon. for consumption here or from the node daemon.
@rtype: tuple @rtype: tuple
@return: master_netdev, master_ip, master_netmask, master_name, @return: master_netdev, master_ip, master_name, primary_ip_family,
primary_ip_family master_netmask
@raise RPCFail: in case of errors @raise RPCFail: in case of errors
""" """
...@@ -245,8 +245,8 @@ def GetMasterInfo(): ...@@ -245,8 +245,8 @@ def GetMasterInfo():
primary_ip_family = cfg.GetPrimaryIPFamily() primary_ip_family = cfg.GetPrimaryIPFamily()
except errors.ConfigurationError, err: except errors.ConfigurationError, err:
_Fail("Cluster configuration incomplete: %s", err, exc=True) _Fail("Cluster configuration incomplete: %s", err, exc=True)
return (master_netdev, master_ip, master_netmask, master_node, return (master_netdev, master_ip, master_node, primary_ip_family,
primary_ip_family) master_netmask)
def ActivateMasterIp(): def ActivateMasterIp():
...@@ -254,7 +254,7 @@ def ActivateMasterIp(): ...@@ -254,7 +254,7 @@ def ActivateMasterIp():
""" """
# GetMasterInfo will raise an exception if not able to return data # GetMasterInfo will raise an exception if not able to return data
master_netdev, master_ip, master_netmask, _, family = GetMasterInfo() master_netdev, master_ip, _, family, master_netmask = GetMasterInfo()
err_msg = None err_msg = None
if netutils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT): if netutils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT):
...@@ -328,7 +328,7 @@ def DeactivateMasterIp(): ...@@ -328,7 +328,7 @@ def DeactivateMasterIp():
# need to decide in which case we fail the RPC for this # need to decide in which case we fail the RPC for this
# GetMasterInfo will raise an exception if not able to return data # GetMasterInfo will raise an exception if not able to return data
master_netdev, master_ip, master_netmask, _, _ = GetMasterInfo() master_netdev, master_ip, _, _, master_netmask = GetMasterInfo()
result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "del", result = utils.RunCmd([constants.IP_COMMAND_PATH, "address", "del",
"%s/%s" % (master_ip, master_netmask), "%s/%s" % (master_ip, master_netmask),
...@@ -360,7 +360,7 @@ def ChangeMasterNetmask(netmask): ...@@ -360,7 +360,7 @@ def ChangeMasterNetmask(netmask):
"""Change the netmask of the master IP. """Change the netmask of the master IP.
""" """
master_netdev, master_ip, old_netmask, _, _ = GetMasterInfo() master_netdev, master_ip, _, _, old_netmask = GetMasterInfo()
if old_netmask == netmask: if old_netmask == netmask:
return return
......
...@@ -796,7 +796,8 @@ def GatherMasterVotes(node_list): ...@@ -796,7 +796,8 @@ def GatherMasterVotes(node_list):
if msg: if msg:
logging.warning("Error contacting node %s: %s", node, msg) logging.warning("Error contacting node %s: %s", node, msg)
fail = True fail = True
# for now we accept both length 3 and 4 (data[3] is primary ip version) # for now we accept both length 3, 4 and 5 (data[3] is primary ip version
# and data[4] is the master netmask)
elif not isinstance(data, (tuple, list)) or len(data) < 3: elif not isinstance(data, (tuple, list)) or len(data) < 3:
logging.warning("Invalid data received from node %s: %s", node, data) logging.warning("Invalid data received from node %s: %s", node, data)
fail = True fail = True
......
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