This simplifies the RPC argument encoding code.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
"""
return self._lu.rpc.call_import_start(self.node_name, self._opts,
self._instance, self._component,
- self._dest, self._dest_args)
+ (self._dest, self._dest_args))
def CheckListening(self):
"""Checks whether the daemon is listening.
return self._lu.rpc.call_export_start(self.node_name, self._opts,
self._dest_host, self._dest_port,
self._instance, self._component,
- self._source, self._source_args)
+ (self._source, self._source_args))
def CheckListening(self):
"""Checks whether the daemon is listening.
return result
@staticmethod
- def _EncodeImportExportIO(ieio, ieioargs):
+ def _EncodeImportExportIO((ieio, ieioargs)):
"""Encodes import/export I/O information.
"""
if ieio == constants.IEIO_RAW_DISK:
assert len(ieioargs) == 1
- return (ieioargs[0].ToDict(), )
+ return (ieio, (ieioargs[0].ToDict(), ))
if ieio == constants.IEIO_SCRIPT:
assert len(ieioargs) == 2
- return (ieioargs[0].ToDict(), ieioargs[1])
+ return (ieio, (ieioargs[0].ToDict(), ieioargs[1]))
- return ieioargs
+ return (ieio, ieioargs)
@staticmethod
def _PrepareFileUpload(filename):
("opts", OBJECT_TO_DICT, None),
("instance", INST_TO_DICT, None),
("component", None, None),
- ("dest", None, None),
- ("dest_args", "self._EncodeImportExportIO(dest, %s)", None),
+ ("dest", "self._EncodeImportExportIO(%s)", "Import destination"),
], None, "Starts an import daemon"),
("export_start", SINGLE, TMO_NORMAL, [
("opts", OBJECT_TO_DICT, None),
("port", None, None),
("instance", INST_TO_DICT, None),
("component", None, None),
- ("source", None, None),
- ("source_args", "self._EncodeImportExportIO(source, %s)", None),
+ ("source", "self._EncodeImportExportIO(%s)", "Export source"),
], None, "Starts an export daemon"),
("impexp_status", SINGLE, TMO_FAST, [
("names", None, "Import/export names"),
"""Starts an import daemon.
"""
- (opts_s, instance, component, dest, dest_args) = params
+ (opts_s, instance, component, (dest, dest_args)) = params
opts = objects.ImportExportOptions.FromDict(opts_s)
"""Starts an export daemon.
"""
- (opts_s, host, port, instance, component, source, source_args) = params
+ (opts_s, host, port, instance, component, (source, source_args)) = params
opts = objects.ImportExportOptions.FromDict(opts_s)