Skip to content
Snippets Groups Projects
Commit b112bfc4 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Move _MakeLegacyNodeInfo to rpc


This function will also be needed for the iallocator refactor. Also this
function does not belong to cmdlib but rather to rpc. Lets move it
there.

Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 0c77c331
No related branches found
No related tags found
No related merge requests found
...@@ -582,20 +582,6 @@ def _ShareAll(): ...@@ -582,20 +582,6 @@ def _ShareAll():
return dict.fromkeys(locking.LEVELS, 1) 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): def _AnnotateDiskParams(instance, devs, cfg):
"""Little helper wrapper to the rpc annotation method. """Little helper wrapper to the rpc annotation method.
   
...@@ -5061,7 +5047,7 @@ class _NodeQuery(_QueryBase): ...@@ -5061,7 +5047,7 @@ class _NodeQuery(_QueryBase):
   
node_data = lu.rpc.call_node_info(toquery_nodes, [lu.cfg.GetVGName()], node_data = lu.rpc.call_node_info(toquery_nodes, [lu.cfg.GetVGName()],
[lu.cfg.GetHypervisorType()]) [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() for (name, nresult) in node_data.items()
if not nresult.fail_msg and nresult.payload) if not nresult.fail_msg and nresult.payload)
else: else:
......
...@@ -564,6 +564,20 @@ def _EncodeBlockdevRename(value): ...@@ -564,6 +564,20 @@ def _EncodeBlockdevRename(value):
return [(d.ToDict(), uid) for d, uid in 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)): def _AnnotateDParamsDRBD(disk, (drbd_params, data_params, meta_params)):
"""Annotates just DRBD disks layouts. """Annotates just DRBD disks layouts.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment