Commit aedf5fd7 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

rpc: Adding new encoders for annotating disk parameters

Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarIustin Pop <>
parent cd46491f
......@@ -664,6 +664,10 @@ class RpcRunner(_RpcClientBase,
rpc_defs.ED_INST_DICT_HVP_BEP: self._InstDictHvpBep,
rpc_defs.ED_INST_DICT_OSP: self._InstDictOsp,
# Encoders annotating disk parameters
rpc_defs.ED_DISKS_DICT_DP: self._DisksDictDP,
rpc_defs.ED_SINGLE_DISK_DICT_DP: self._SingleDiskDictDP,
# Encoders with special requirements
rpc_defs.ED_FILE_DETAILS: compat.partial(_PrepareFileUpload, _getents),
......@@ -732,6 +736,22 @@ class RpcRunner(_RpcClientBase,
return self._InstDict(instance, osp=osparams)
def _DisksDictDP(self, (disks, instance)):
"""Wrapper for L{AnnotateDiskParams}.
diskparams = self._cfg.GetInstanceDiskParams(instance)
return [disk.ToDict()
for disk in AnnotateDiskParams(instance.disk_template,
disks, diskparams)]
def _SingleDiskDictDP(self, (disk, instance)):
"""Wrapper for L{AnnotateDiskParams}.
(anno_disk,) = self._DisksDictDP(([disk], instance))
return anno_disk
class JobQueueRunner(_RpcClientBase, _generated_rpc.RpcClientJobQueue):
"""RPC wrappers for job queue.
......@@ -71,7 +71,9 @@ ACCEPT_OFFLINE_NODE = object()
ED_BLOCKDEV_RENAME) = range(1, 12)
ED_SINGLE_DISK_DICT_DP) = range(1, 14)
def _Prepare(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