Commit 6bf01bbb authored by Guido Trotter's avatar Guido Trotter
Browse files

Parallelize LUDiagnoseOS

Reviewed-by: iustinp
parent 895ecd9c
......@@ -1218,13 +1218,9 @@ class LUDiagnoseOS(NoHooksLU):
"""
_OP_REQP = ["output_fields", "names"]
REQ_BGL = False
def CheckPrereq(self):
"""Check prerequisites.
This always succeeds, since this is a pure query LU.
"""
def ExpandNames(self):
if self.op.names:
raise errors.OpPrereqError("Selective OS query not supported")
......@@ -1233,6 +1229,16 @@ class LUDiagnoseOS(NoHooksLU):
dynamic=self.dynamic_fields,
selected=self.op.output_fields)
# Lock all nodes, in shared mode
self.needed_locks = {}
self.share_locks[locking.LEVEL_NODE] = 1
self.needed_locks[locking.LEVEL_NODE] = None
def CheckPrereq(self):
"""Check prerequisites.
"""
@staticmethod
def _DiagnoseByOS(node_list, rlist):
"""Remaps a per-node return list into an a per-os per-node dictionary
......@@ -1268,7 +1274,7 @@ class LUDiagnoseOS(NoHooksLU):
"""Compute the list of OSes.
"""
node_list = self.cfg.GetNodeList()
node_list = self.acquired_locks[locking.LEVEL_NODE]
node_data = rpc.call_os_diagnose(node_list)
if node_data == False:
raise errors.OpExecError("Can't gather the list of OSes")
......
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