Commit 9834e2bc authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

rpc: Convert import/export functions


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent efc71a02
......@@ -342,6 +342,5 @@ _MISC_CALLS = [
]
CALLS = {
"RpcClientDefault": [
],
"RpcClientDefault": _IMPEXP_CALLS,
}
......@@ -1384,52 +1384,6 @@ class RpcRunner(_generated_rpc.RpcClientDefault):
"""
return self._SingleNodeCall(node, "blockdev_snapshot", [cf_bdev.ToDict()])
@_RpcTimeout(_TMO_NORMAL)
def call_finalize_export(self, node, instance, snap_disks):
"""Request the completion of an export operation.
This writes the export config file, etc.
This is a single-node call.
"""
flat_disks = []
for disk in snap_disks:
if isinstance(disk, bool):
flat_disks.append(disk)
else:
flat_disks.append(disk.ToDict())
return self._SingleNodeCall(node, "finalize_export",
[self._InstDict(instance), flat_disks])
@_RpcTimeout(_TMO_FAST)
def call_export_info(self, node, path):
"""Queries the export information in a given path.
This is a single-node call.
"""
return self._SingleNodeCall(node, "export_info", [path])
@_RpcTimeout(_TMO_FAST)
def call_export_list(self, node_list):
"""Gets the stored exports list.
This is a multi-node call.
"""
return self._MultiNodeCall(node_list, "export_list", [])
@_RpcTimeout(_TMO_FAST)
def call_export_remove(self, node, export):
"""Requests removal of a given export.
This is a single-node call.
"""
return self._SingleNodeCall(node, "export_remove", [export])
@classmethod
@_RpcTimeout(_TMO_NORMAL)
def call_node_leave_cluster(cls, node, modify_ssh_setup):
......@@ -1628,61 +1582,3 @@ class RpcRunner(_generated_rpc.RpcClientDefault):
self._InstDict(instance),
component, source,
_EncodeImportExportIO(source, source_args)])
@_RpcTimeout(_TMO_FAST)
def call_impexp_status(self, node, names):
"""Gets the status of an import or export.
This is a single-node call.
@type node: string
@param node: Node name
@type names: List of strings
@param names: Import/export names
@rtype: 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
"""
result = self._SingleNodeCall(node, "impexp_status", [names])
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
@_RpcTimeout(_TMO_NORMAL)
def call_impexp_abort(self, node, name):
"""Aborts an import or export.
This is a single-node call.
@type node: string
@param node: Node name
@type name: string
@param name: Import/export name
"""
return self._SingleNodeCall(node, "impexp_abort", [name])
@_RpcTimeout(_TMO_NORMAL)
def call_impexp_cleanup(self, node, name):
"""Cleans up after an import or export.
This is a single-node call.
@type node: string
@param node: Node name
@type name: string
@param name: Import/export name
"""
return self._SingleNodeCall(node, "impexp_cleanup", [name])
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