Commit 83d92ad8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert os_diagnose rpc to new style result

This also removes custom post-processing from; since this call
has only one user, it was simple to move it back to the caller.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 90b54c26
......@@ -608,7 +608,7 @@ class NodeHttpServer(http.server.HttpServer):
"""Query detailed information about existing OSes.
return [os_obj.ToDict() for os_obj in backend.DiagnoseOS()]
return True, [os_obj.ToDict() for os_obj in backend.DiagnoseOS()]
def perspective_os_get(params):
......@@ -1811,11 +1811,12 @@ class LUDiagnoseOS(NoHooksLU):
# level), so that nodes with a non-responding node daemon don't
# make all OSes invalid
good_nodes = [node_name for node_name in rlist
if not rlist[node_name].failed]
for node_name, nr in rlist.iteritems():
if nr.failed or not
if not rlist[node_name].RemoteFailMsg()]
for node_name, nr in rlist.items():
if nr.RemoteFailMsg() or not nr.payload:
for os_obj in
for os_serialized in nr.payload:
os_obj = objects.OS.FromDict(os_serialized)
if not in all_os:
# build a list of nodes for this os containing empty lists
# for each node in node_list
......@@ -1831,11 +1832,9 @@ class LUDiagnoseOS(NoHooksLU):
valid_nodes = [node for node in self.cfg.GetOnlineNodeList()]
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(valid_nodes, node_data)
output = []
for os_name, os_data in pol.iteritems():
for os_name, os_data in pol.items():
row = []
for field in self.op.output_fields:
if field == "name":
......@@ -864,13 +864,7 @@ class RpcRunner(object):
This is a multi-node call.
result = self._MultiNodeCall(node_list, "os_diagnose", [])
for node_result in result.values():
if not node_result.failed and = [objects.OS.FromDict(oss)
for oss in]
return result
return self._MultiNodeCall(node_list, "os_diagnose", [])
def call_os_get(self, node, name):
"""Returns an OS definition.
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