Commit efc71a02 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

rpc: Add helpers

These will be used by the generated RPC wrappers.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 200de241
......@@ -556,6 +556,71 @@ class RpcRunner(_generated_rpc.RpcClientDefault):
return proc([node], procedure, body, read_timeout=read_timeout)[node]
def _BlockdevFindPostProc(result):
if not result.fail_msg and result.payload is not None:
result.payload = objects.BlockDevStatus.FromDict(result.payload)
return result
def _BlockdevGetMirrorStatusPostProc(result):
if not result.fail_msg:
result.payload = [objects.BlockDevStatus.FromDict(i)
for i in result.payload]
return result
def _BlockdevGetMirrorStatusMultiPostProc(result):
for nres in result.values():
if nres.fail_msg:
for idx, (success, status) in enumerate(nres.payload):
if success:
nres.payload[idx] = (success, objects.BlockDevStatus.FromDict(status))
return result
def _OsGetPostProc(result):
if not result.fail_msg and isinstance(result.payload, dict):
result.payload = objects.OS.FromDict(result.payload)
return result
def _PrepareFinalizeExportDisks(snap_disks):
flat_disks = []
for disk in snap_disks:
if isinstance(disk, bool):
return flat_disks
def _ImpExpStatusPostProc(result):
"""Post-processor for import/export status.
@rtype: Payload containing list of L{objects.ImportExportStatus} instances
@return: Returns a list of the state of each named import/export or None if
a status couldn't be retrieved
if not result.fail_msg:
decoded = []
for i in result.payload:
if i is None:
result.payload = decoded
return result
# Begin RPC calls
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