Commit 6819dc49 authored by Iustin Pop's avatar Iustin Pop

Fix redistribute config and offline nodes

We need to manually filter out offline nodes before using
rpc.call_upload_file and rpc.call_write_ssconf_files, since these method
are static (they work without a ConfigWriter instance) and thus do not
know which nodes are offline and which are not).

Note that we add a new ConfigWriter._UnlockedGetOnlineNodeList() method
rather than hardcoding the filtering of online nodes in _WriteConfig.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent c56f51ef
......@@ -2155,7 +2155,7 @@ def _RedistributeAncillaryFiles(lu, additional_nodes=None):
"""
# 1. Gather target nodes
myself = lu.cfg.GetNodeInfo(lu.cfg.GetMasterNode())
dist_nodes = lu.cfg.GetNodeList()
dist_nodes = lu.cfg.GetOnlineNodeList()
if additional_nodes is not None:
dist_nodes.extend(additional_nodes)
if myself.name in dist_nodes:
......
......@@ -1056,8 +1056,7 @@ class ConfigWriter:
"""
return self._UnlockedGetNodeList()
@locking.ssynchronized(_config_lock, shared=1)
def GetOnlineNodeList(self):
def _UnlockedGetOnlineNodeList(self):
"""Return the list of nodes which are online.
"""
......@@ -1065,6 +1064,13 @@ class ConfigWriter:
for node in self._UnlockedGetNodeList()]
return [node.name for node in all_nodes if not node.offline]
@locking.ssynchronized(_config_lock, shared=1)
def GetOnlineNodeList(self):
"""Return the list of nodes which are online.
"""
return self._UnlockedGetOnlineNodeList()
@locking.ssynchronized(_config_lock, shared=1)
def GetAllNodesInfo(self):
"""Get the configuration of all nodes.
......@@ -1293,7 +1299,7 @@ class ConfigWriter:
if self._last_cluster_serial < self._config_data.cluster.serial_no:
if not self._offline:
result = rpc.RpcRunner.call_write_ssconf_files(
self._UnlockedGetNodeList(),
self._UnlockedGetOnlineNodeList(),
self._UnlockedGetSsconfValues())
for nname, nresu in result.items():
......
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