Commit 6613661a authored by Iustin Pop's avatar Iustin Pop
Browse files

Instance transfer: export component name to backend



This modifies the RPC layer to export the component name too to the
backend, so that it can be used in log files and messages.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 5e26c4d9
......@@ -2964,7 +2964,8 @@ def _CreateImportExportStatusDir(prefix):
(prefix, utils.TimestampForFilename())))
def StartImportExportDaemon(mode, opts, host, port, instance, ieio, ieioargs):
def StartImportExportDaemon(mode, opts, host, port, instance, component,
ieio, ieioargs):
"""Starts an import or export daemon.
@param mode: Import/output mode
......@@ -2976,6 +2977,9 @@ def StartImportExportDaemon(mode, opts, host, port, instance, ieio, ieioargs):
@param port: Remote port for export (None for import)
@type instance: L{objects.Instance}
@param instance: Instance object
@type component: string
@param component: which part of the instance is transferred now,
e.g. 'disk/0'
@param ieio: Input/output type
@param ieioargs: Input/output arguments
......@@ -3015,7 +3019,7 @@ def StartImportExportDaemon(mode, opts, host, port, instance, ieio, ieioargs):
if not os.path.exists(i):
_Fail("File '%s' does not exist" % i)
status_dir = _CreateImportExportStatusDir(prefix)
status_dir = _CreateImportExportStatusDir("%s-%s" % (prefix, component))
try:
status_file = utils.PathJoin(status_dir, _IES_STATUS_FILE)
pid_file = utils.PathJoin(status_dir, _IES_PID_FILE)
......
......@@ -534,7 +534,7 @@ class DiskImport(_DiskImportExportBase):
"""
return self._lu.rpc.call_import_start(self.node_name, self._opts,
self._instance,
self._instance, self._component,
self._dest, self._dest_args)
def CheckListening(self):
......@@ -620,8 +620,8 @@ class DiskExport(_DiskImportExportBase):
"""
return self._lu.rpc.call_export_start(self.node_name, self._opts,
self._dest_host, self._dest_port,
self._instance, self._source,
self._source_args)
self._instance, self._component,
self._source, self._source_args)
def CheckListening(self):
"""Checks whether the daemon is listening.
......
......@@ -1498,7 +1498,8 @@ class RpcRunner(object):
return self._SingleNodeCall(node, "x509_cert_remove", [name])
@_RpcTimeout(_TMO_NORMAL)
def call_import_start(self, node, opts, instance, dest, dest_args):
def call_import_start(self, node, opts, instance, component,
dest, dest_args):
"""Starts a listener for an import.
This is a single-node call.
......@@ -1507,16 +1508,18 @@ class RpcRunner(object):
@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), dest,
self._InstDict(instance), component, dest,
_EncodeImportExportIO(dest, dest_args)])
@_RpcTimeout(_TMO_NORMAL)
def call_export_start(self, node, opts, host, port,
instance, source, source_args):
instance, component, source, source_args):
"""Starts an export daemon.
This is a single-node call.
......@@ -1525,11 +1528,14 @@ class RpcRunner(object):
@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), source,
self._InstDict(instance),
component, source,
_EncodeImportExportIO(source, source_args)])
@_RpcTimeout(_TMO_FAST)
......
......@@ -919,14 +919,14 @@ class NodeHttpServer(http.server.HttpServer):
"""Starts an import daemon.
"""
(opts_s, instance, dest, dest_args) = params
(opts_s, instance, component, dest, dest_args) = params
opts = objects.ImportExportOptions.FromDict(opts_s)
return backend.StartImportExportDaemon(constants.IEM_IMPORT, opts,
None, None,
objects.Instance.FromDict(instance),
dest,
component, dest,
_DecodeImportExportIO(dest,
dest_args))
......@@ -935,14 +935,14 @@ class NodeHttpServer(http.server.HttpServer):
"""Starts an export daemon.
"""
(opts_s, host, port, instance, source, source_args) = params
(opts_s, host, port, instance, component, source, source_args) = params
opts = objects.ImportExportOptions.FromDict(opts_s)
return backend.StartImportExportDaemon(constants.IEM_EXPORT, opts,
host, port,
objects.Instance.FromDict(instance),
source,
component, source,
_DecodeImportExportIO(source,
source_args))
......
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