Commit 00fe9e38 authored by Guido Trotter's avatar Guido Trotter
Browse files

Make call_os_get a single node function

call_os_get is never called with a real list of nodes, so there's no point in
it being multi-node. Making it single-node till a usage for multi-node call is
found.

Reviewed-By: iustinp
parent 74b4217d
......@@ -2158,7 +2158,7 @@ class LUReinstallInstance(LogicalUnit):
if pnode is None:
raise errors.OpPrereqError("Primary node '%s' is unknown" %
self.op.pnode)
os_obj = rpc.call_os_get([pnode.name], self.op.os_type)[pnode.name]
os_obj = rpc.call_os_get(pnode.name, self.op.os_type)
if not isinstance(os_obj, objects.OS):
raise errors.OpPrereqError("OS '%s' not in supported OS list for"
" primary node" % self.op.os_type)
......@@ -2949,7 +2949,7 @@ class LUCreateInstance(LogicalUnit):
(node, info['vg_free'], req_size))
# os verification
os_obj = rpc.call_os_get([pnode.name], self.op.os_type)[pnode.name]
os_obj = rpc.call_os_get(pnode.name, self.op.os_type)
if not isinstance(os_obj, objects.OS):
raise errors.OpPrereqError("OS '%s' not in supported os list for"
" primary node" % self.op.os_type)
......
......@@ -653,25 +653,24 @@ def call_os_diagnose(node_list):
return new_result
def call_os_get(node_list, name):
def call_os_get(node, name):
"""Returns an OS definition.
This is a multi-node call.
This is a single-node call.
"""
c = Client("os_get", [name])
c.connect_list(node_list)
c.connect(node)
c.run()
result = c.getresult()
new_result = {}
for node_name in result:
data = result[node_name]
if isinstance(data, dict):
new_result[node_name] = objects.OS.FromDict(data)
elif isinstance(data, tuple) and len(data) == 3:
new_result[node_name] = errors.InvalidOS(data[0], data[1], data[2])
else:
new_result[node_name] = data
result = c.getresult().get(node, False)
if isinstance(result, dict):
new_result = objects.OS.FromDict(result)
elif isinstance(result, tuple) and len(data) == 3:
new_result = errors.InvalidOS(result[0], result[1], result[2])
else:
new_result = result
return new_result
......
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