+
+def _Prepare(calls):
+ """Converts list of calls to dictionary.
+
+ """
+ return utils.SequenceToDict(calls)
+
+
+def _MigrationStatusPostProc(result):
+ """Post-processor for L{rpc.RpcRunner.call_instance_get_migration_status}.
+
+ """
+ if not result.fail_msg and result.payload is not None:
+ result.payload = objects.MigrationStatus.FromDict(result.payload)
+ return result
+
+
+def _BlockdevFindPostProc(result):
+ """Post-processor for L{rpc.RpcRunner.call_blockdev_find}.
+
+ """
+ if not result.fail_msg and result.payload is not None:
+ result.payload = objects.BlockDevStatus.FromDict(result.payload)
+ return result
+
+
+def _BlockdevGetMirrorStatusPostProc(result):
+ """Post-processor for L{rpc.RpcRunner.call_blockdev_getmirrorstatus}.
+
+ """
+ if not result.fail_msg:
+ result.payload = map(objects.BlockDevStatus.FromDict, result.payload)
+ return result
+
+
+def _BlockdevGetMirrorStatusMultiPreProc(node, args):
+ """Prepares the appropriate node values for blockdev_getmirrorstatus_multi.
+
+ """
+ # there should be only one argument to this RPC, already holding a
+ # node->disks dictionary, we just need to extract the value for the
+ # current node
+ assert len(args) == 1
+ return [args[0][node]]
+
+
+def _BlockdevGetMirrorStatusMultiPostProc(result):
+ """Post-processor for L{rpc.RpcRunner.call_blockdev_getmirrorstatus_multi}.
+
+ """
+ if not result.fail_msg:
+ for idx, (success, status) in enumerate(result.payload):
+ if success:
+ result.payload[idx] = (success, objects.BlockDevStatus.FromDict(status))
+
+ return result
+
+
+def _OsGetPostProc(result):
+ """Post-processor for L{rpc.RpcRunner.call_os_get}.
+
+ """
+ if not result.fail_msg and isinstance(result.payload, dict):
+ result.payload = objects.OS.FromDict(result.payload)
+ return result
+
+
+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:
+ decoded.append(None)
+ continue
+ decoded.append(objects.ImportExportStatus.FromDict(i))
+
+ result.payload = decoded
+
+ return result
+
+
+def _TestDelayTimeout((duration, )):
+ """Calculate timeout for "test_delay" RPC.
+
+ """
+ return int(duration + 5)
+
+