diff --git a/lib/build/rpc_definitions.py b/lib/build/rpc_definitions.py index b3f183e710929e434bad7d5881a132e8059e66de..5400b33d8aecd448163860c94328d30748b70651 100644 --- a/lib/build/rpc_definitions.py +++ b/lib/build/rpc_definitions.py @@ -145,6 +145,22 @@ _INSTANCE_CALLS = [ ] _IMPEXP_CALLS = [ + ("import_start", SINGLE, TMO_NORMAL, [ + ("opts", OBJECT_TO_DICT, None), + ("instance", INST_TO_DICT, None), + ("component", None, None), + ("dest", None, None), + ("dest_args", "self._EncodeImportExportIO(dest, %s)", None), + ], None, "Starts an import daemon"), + ("export_start", SINGLE, TMO_NORMAL, [ + ("opts", OBJECT_TO_DICT, None), + ("host", None, None), + ("port", None, None), + ("instance", INST_TO_DICT, None), + ("component", None, None), + ("source", None, None), + ("source_args", "self._EncodeImportExportIO(source, %s)", None), + ], None, "Starts an export daemon"), ("impexp_status", SINGLE, TMO_FAST, [ ("names", None, "Import/export names"), ], "self._ImpExpStatusPostProc", "Gets the status of an import or export"), diff --git a/lib/rpc.py b/lib/rpc.py index e4b8507f0a0d59c489ee00df300c2cc50b7b01d0..6f36ceb8b446d75957cb8302dcc0c0d16c83b077 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -437,21 +437,6 @@ class _RpcProcessor: return self._CombineResults(results, requests, procedure) -def _EncodeImportExportIO(ieio, ieioargs): - """Encodes import/export I/O information. - - """ - if ieio == constants.IEIO_RAW_DISK: - assert len(ieioargs) == 1 - return (ieioargs[0].ToDict(), ) - - if ieio == constants.IEIO_SCRIPT: - assert len(ieioargs) == 2 - return (ieioargs[0].ToDict(), ieioargs[1]) - - return ieioargs - - class RpcRunner(_generated_rpc.RpcClientDefault): """RPC runner class. @@ -621,6 +606,21 @@ class RpcRunner(_generated_rpc.RpcClientDefault): return result + @staticmethod + def _EncodeImportExportIO(ieio, ieioargs): + """Encodes import/export I/O information. + + """ + if ieio == constants.IEIO_RAW_DISK: + assert len(ieioargs) == 1 + return (ieioargs[0].ToDict(), ) + + if ieio == constants.IEIO_SCRIPT: + assert len(ieioargs) == 2 + return (ieioargs[0].ToDict(), ieioargs[1]) + + return ieioargs + # # Begin RPC calls # @@ -832,44 +832,3 @@ class RpcRunner(_generated_rpc.RpcClientDefault): hv_full = objects.FillDict(cluster.hvparams.get(hvname, {}), hvparams) return self._MultiNodeCall(node_list, "hypervisor_validate_params", [hvname, hv_full]) - - @_RpcTimeout(_TMO_NORMAL) - def call_import_start(self, node, opts, instance, component, - dest, dest_args): - """Starts a listener for an import. - - This is a single-node call. - - @type node: string - @param node: Node name - @type instance: C{objects.Instance} - @param instance: Instance object - @type component: string - @param component: which part of the instance is being imported - - """ - return self._SingleNodeCall(node, "import_start", - [opts.ToDict(), - self._InstDict(instance), component, dest, - _EncodeImportExportIO(dest, dest_args)]) - - @_RpcTimeout(_TMO_NORMAL) - def call_export_start(self, node, opts, host, port, - instance, component, source, source_args): - """Starts an export daemon. - - This is a single-node call. - - @type node: string - @param node: Node name - @type instance: C{objects.Instance} - @param instance: Instance object - @type component: string - @param component: which part of the instance is being imported - - """ - return self._SingleNodeCall(node, "export_start", - [opts.ToDict(), host, port, - self._InstDict(instance), - component, source, - _EncodeImportExportIO(source, source_args)])