Commit 4478301b authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Improve import/export timeout settings



With this patch, the exporting node will retry to connect a few times.
The receiving node will make use of the master's increased timeout (see
previous patch).
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 8fd2e34c
......@@ -2890,6 +2890,15 @@ def StartImportExportDaemon(mode, opts, host, port, instance, ieio, ieioargs):
if cmd_suffix:
cmd.append("--cmd-suffix=%s" % cmd_suffix)
if mode == constants.IEM_EXPORT:
# Retry connection a few times when connecting to remote peer
cmd.append("--connect-retries=%s" % constants.RIE_CONNECT_RETRIES)
cmd.append("--connect-timeout=%s" % constants.RIE_CONNECT_ATTEMPT_TIMEOUT)
elif opts.connect_timeout is not None:
assert mode == constants.IEM_IMPORT
# Overall timeout for establishing connection while listening
cmd.append("--connect-timeout=%s" % opts.connect_timeout)
logfile = _InstanceLogName(prefix, instance.os, instance.name)
# TODO: Once _InstanceLogName uses tempfile.mkstemp, StartDaemon has
......
......@@ -421,9 +421,15 @@ RIE_HANDSHAKE = "Hi, I'm Ganeti"
# Remote import/export certificate validity in seconds
RIE_CERT_VALIDITY = 24 * 60 * 60
# Remote import/export connect timeout for socat
# Overall timeout for establishing connection
RIE_CONNECT_TIMEOUT = 180
# Export only: how long to wait per connection attempt (seconds)
RIE_CONNECT_ATTEMPT_TIMEOUT = 20
# Export only: number of attempts to connect
RIE_CONNECT_RETRIES = 10
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
DT_DRBD8, DT_FILE])
......
......@@ -161,12 +161,16 @@ class _DiskImportExportBase(object):
self._lu = lu
self.node_name = node_name
self._opts = opts
self._opts = opts.Copy()
self._instance = instance
self._timeouts = timeouts
self._cbs = cbs
self._private = private
# Set master daemon's timeout in options for import/export daemon
assert self._opts.connect_timeout is None
self._opts.connect_timeout = timeouts.connect
# Parent loop
self._loop = None
......
......@@ -1272,6 +1272,7 @@ class ImportExportOptions(ConfigObject):
@ivar ca_pem: Remote peer CA in PEM format (None for cluster certificate)
@ivar compress: Compression method (one of L{constants.IEC_ALL})
@ivar magic: Used to ensure the connection goes to the right disk
@ivar connect_timeout: Number of seconds for establishing connection
"""
__slots__ = [
......@@ -1279,6 +1280,7 @@ class ImportExportOptions(ConfigObject):
"ca_pem",
"compress",
"magic",
"connect_timeout",
]
......
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