Commit 94a02bb5 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix gnt-os for offline nodes

We shouldn't query offline nodes in gnt-os. This patch adds an utility
function to ConfigWriter that returns the names of online nodes and uses
it in LUDiagnoseOS to query only the good nodes.

Reviewed-by: imsnah
parent 186ec53c
......@@ -1587,10 +1587,12 @@ class LUDiagnoseOS(NoHooksLU):
"""
node_list = self.acquired_locks[locking.LEVEL_NODE]
node_data = self.rpc.call_os_diagnose(node_list)
valid_nodes = [node for node in self.cfg.GetOnlineNodeList()
if node in node_list]
node_data = self.rpc.call_os_diagnose(valid_nodes)
if node_data == False:
raise errors.OpExecError("Can't gather the list of OSes")
pol = self._DiagnoseByOS(node_list, node_data)
pol = self._DiagnoseByOS(valid_nodes, node_data)
output = []
for os_name, os_data in pol.iteritems():
row = []
......
......@@ -786,6 +786,15 @@ class ConfigWriter:
"""
return self._UnlockedGetNodeList()
@locking.ssynchronized(_config_lock, shared=1)
def GetOnlineNodeList(self):
"""Return the list of nodes which are online.
"""
all_nodes = [self._UnlockedGetNodeInfo(node)
for node in self._UnlockedGetNodeList()]
return [node.name for node in all_nodes if not node.offline]
@locking.ssynchronized(_config_lock, shared=1)
def GetAllNodesInfo(self):
"""Get the configuration of all nodes.
......
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