diff --git a/lib/cmdlib.py b/lib/cmdlib.py index c41a0780457fef6c3689ae91e3c72091d4556847..ca42f79fbb97aa840df0d169cf018a1eba6bec80 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -582,20 +582,6 @@ def _ShareAll(): return dict.fromkeys(locking.LEVELS, 1) -def _MakeLegacyNodeInfo(data): - """Formats the data returned by L{rpc.RpcRunner.call_node_info}. - - Converts the data into a single dictionary. This is fine for most use cases, - but some require information from more than one volume group or hypervisor. - - """ - (bootid, (vg_info, ), (hv_info, )) = data - - return utils.JoinDisjointDicts(utils.JoinDisjointDicts(vg_info, hv_info), { - "bootid": bootid, - }) - - def _AnnotateDiskParams(instance, devs, cfg): """Little helper wrapper to the rpc annotation method. @@ -5061,7 +5047,7 @@ class _NodeQuery(_QueryBase): node_data = lu.rpc.call_node_info(toquery_nodes, [lu.cfg.GetVGName()], [lu.cfg.GetHypervisorType()]) - live_data = dict((name, _MakeLegacyNodeInfo(nresult.payload)) + live_data = dict((name, rpc.MakeLegacyNodeInfo(nresult.payload)) for (name, nresult) in node_data.items() if not nresult.fail_msg and nresult.payload) else: diff --git a/lib/rpc.py b/lib/rpc.py index 8327732c011e67b8de66a2411a83cd2190d2c1b4..9a15467bc1d6f816a27263b4c9493a26d1fc81d4 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -564,6 +564,20 @@ def _EncodeBlockdevRename(value): return [(d.ToDict(), uid) for d, uid in value] +def MakeLegacyNodeInfo(data): + """Formats the data returned by L{rpc.RpcRunner.call_node_info}. + + Converts the data into a single dictionary. This is fine for most use cases, + but some require information from more than one volume group or hypervisor. + + """ + (bootid, (vg_info, ), (hv_info, )) = data + + return utils.JoinDisjointDicts(utils.JoinDisjointDicts(vg_info, hv_info), { + "bootid": bootid, + }) + + def _AnnotateDParamsDRBD(disk, (drbd_params, data_params, meta_params)): """Annotates just DRBD disks layouts.