Commit f5410303 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Add timeouts for OS install helper VM



Add timeout parameters to client, opcodes, LU, etc.  The startup
timeout is similar to that one used in zeroing, but the shutdown
timeout is different because it is a single timeout that includes the
time needed to install plus shutdown.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 1fbe43de
......@@ -232,6 +232,8 @@ __all__ = [
"YES_DOIT_OPT",
"ZEROING_IMAGE_OPT",
"ZERO_FREE_SPACE_OPT",
"HELPER_STARTUP_TIMEOUT_OPT",
"HELPER_SHUTDOWN_TIMEOUT_OPT",
"ZEROING_TIMEOUT_FIXED_OPT",
"ZEROING_TIMEOUT_PER_MIB_OPT",
"DISK_STATE_OPT",
......@@ -1766,6 +1768,16 @@ ZERO_FREE_SPACE_OPT = \
help="Whether to zero the free space on the disks of the "
"instance prior to the export")
HELPER_STARTUP_TIMEOUT_OPT = \
cli_option("--helper-startup-timeout",
dest="helper_startup_timeout", action="store", type="int",
help="Startup timeout for the helper VM")
HELPER_SHUTDOWN_TIMEOUT_OPT = \
cli_option("--helper-shutdown-timeout",
dest="helper_shutdown_timeout", action="store", type="int",
help="Shutdown timeout for the helper VM")
ZEROING_TIMEOUT_FIXED_OPT = \
cli_option("--zeroing-timeout-fixed",
dest="zeroing_timeout_fixed", action="store", type="int",
......@@ -2815,6 +2827,9 @@ def GenericInstanceCreate(mode, opts, args):
osparams_private = opts.osparams_private or serializer.PrivateDict()
osparams_secret = opts.osparams_secret or serializer.PrivateDict()
helper_startup_timeout = opts.helper_startup_timeout
helper_shutdown_timeout = opts.helper_shutdown_timeout
if mode == constants.INSTANCE_CREATE:
start = opts.start
os_type = opts.os
......@@ -2870,7 +2885,9 @@ def GenericInstanceCreate(mode, opts, args):
no_install=no_install,
identify_defaults=identify_defaults,
ignore_ipolicy=opts.ignore_ipolicy,
instance_communication=instance_communication)
instance_communication=instance_communication,
helper_startup_timeout=helper_startup_timeout,
helper_shutdown_timeout=helper_shutdown_timeout)
SubmitOrSend(op, opts)
return 0
......
......@@ -140,6 +140,8 @@ import_opts = [
SRC_NODE_OPT,
COMPRESS_OPT,
IGNORE_IPOLICY_OPT,
HELPER_STARTUP_TIMEOUT_OPT,
HELPER_SHUTDOWN_TIMEOUT_OPT,
]
......
......@@ -1485,6 +1485,8 @@ add_opts = [
NO_INSTALL_OPT,
IGNORE_IPOLICY_OPT,
INSTANCE_COMMUNICATION_OPT,
HELPER_STARTUP_TIMEOUT_OPT,
HELPER_SHUTDOWN_TIMEOUT_OPT,
]
commands = {
......
......@@ -438,6 +438,13 @@ class LUInstanceCreate(LogicalUnit):
constants.INIC_NETWORK:
self.cfg.GetInstanceCommunicationNetwork()})
# timeouts for unsafe OS installs
if self.op.helper_startup_timeout is None:
self.op.helper_startup_timeout = constants.HELPER_VM_STARTUP
if self.op.helper_shutdown_timeout is None:
self.op.helper_shutdown_timeout = constants.HELPER_VM_SHUTDOWN
# check nics' parameter names
for nic in self.op.nics:
utils.ForceDictType(nic, constants.INIC_PARAMS_TYPES)
......
......@@ -4945,13 +4945,18 @@ statSize = "size"
-- * Helper VM-related timeouts
-- | The default fixed timeout - needed to startup the helper VM
-- | The default fixed timeout needed to startup the helper VM.
helperVmStartup :: Int
helperVmStartup = 5 * 60
-- | The default fixed timeout needed until the helper VM is finally
-- shutdown, for example, after installing the OS.
helperVmShutdown :: Int
helperVmShutdown = 2 * 60 * 60
-- | The zeroing timeout per MiB of disks to zero
--
-- Determined by estimating that a disk writes at a relatively slow speed of 1/5
-- of the max speed of current drives
-- Determined by estimating that a disk writes at a relatively slow
-- speed of 1/5 of the max speed of current drives.
zeroingTimeoutPerMib :: Double
zeroingTimeoutPerMib = 1.0 / (100.0 / 5.0)
......@@ -460,6 +460,8 @@ $(genOpCode "OpCode"
, pStartInstance
, pInstTags
, pInstanceCommunication
, pHelperStartupTimeout
, pHelperShutdownTimeout
],
"instance_name")
, ("OpInstanceMultiAlloc",
......
......@@ -222,6 +222,8 @@ module Ganeti.OpParams
, pX509KeyName
, pX509DestCA
, pZeroFreeSpace
, pHelperStartupTimeout
, pHelperShutdownTimeout
, pZeroingTimeoutFixed
, pZeroingTimeoutPerMiB
, pTagSearchPattern
......@@ -1506,6 +1508,16 @@ pZeroFreeSpace =
withDoc "Whether to zero the free space on the disks of the instance" $
defaultFalse "zero_free_space"
pHelperStartupTimeout :: Field
pHelperStartupTimeout =
withDoc "Startup timeout for the helper VM" .
optionalField $ simpleField "helper_startup_timeout" [t| Int |]
pHelperShutdownTimeout :: Field
pHelperShutdownTimeout =
withDoc "Shutdown timeout for the helper VM" .
optionalField $ simpleField "helper_shutdown_timeout" [t| Int |]
pZeroingTimeoutFixed :: Field
pZeroingTimeoutFixed =
withDoc "The fixed part of time to wait before declaring the zeroing\
......
......@@ -298,6 +298,8 @@ instance Arbitrary OpCodes.OpCode where
<*> arbitrary -- start
<*> (genTags >>= mapM mkNonEmpty) -- tags
<*> arbitrary -- instance_communication
<*> arbitrary -- helper_startup_timeout
<*> arbitrary -- helper_shutdown_timeout
"OP_INSTANCE_MULTI_ALLOC" ->
OpCodes.OpInstanceMultiAlloc <$> arbitrary <*> genMaybe genNameNE <*>
pure []
......
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