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

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 <>
Reviewed-by: default avatarMichael Hanselmann <>
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:
if 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 [ 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(
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