Fixed.

Thanks,
Jose

On May 14 10:41, Hrvoje Ribicic wrote:
> LGTM, thanks
> 
> 
> On Tue, May 13, 2014 at 10:43 AM, 'Jose A. Lopes' via ganeti-devel <
> [email protected]> wrote:
> 
> > 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: Jose A. Lopes <[email protected]>
> > ---
> >  lib/cli.py                     | 19 ++++++++++++++++++-
> >  lib/client/gnt_backup.py       |  2 ++
> >  lib/client/gnt_instance.py     |  2 ++
> >  lib/cmdlib/instance.py         |  7 +++++++
> >  src/Ganeti/Constants.hs        | 11 ++++++++---
> >  src/Ganeti/OpCodes.hs          |  2 ++
> >  src/Ganeti/OpParams.hs         | 14 +++++++++++++-
> >  test/hs/Test/Ganeti/OpCodes.hs |  2 ++
> >  8 files changed, 54 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/cli.py b/lib/cli.py
> > index 8582f30..067541b 100644
> > --- a/lib/cli.py
> > +++ b/lib/cli.py
> > @@ -231,6 +231,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",
> > @@ -1760,6 +1762,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",
> > @@ -2809,6 +2821,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
> > @@ -2864,7 +2879,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
> > diff --git a/lib/client/gnt_backup.py b/lib/client/gnt_backup.py
> > index dedfe51..0c29361 100644
> > --- a/lib/client/gnt_backup.py
> > +++ b/lib/client/gnt_backup.py
> > @@ -140,6 +140,8 @@ import_opts = [
> >    SRC_NODE_OPT,
> >    COMPRESS_OPT,
> >    IGNORE_IPOLICY_OPT,
> > +  HELPER_STARTUP_TIMEOUT_OPT,
> > +  HELPER_SHUTDOWN_TIMEOUT_OPT,
> >    ]
> >
> >
> > diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py
> > index 8ded045..2eaec70 100644
> > --- a/lib/client/gnt_instance.py
> > +++ b/lib/client/gnt_instance.py
> > @@ -1485,6 +1485,8 @@ add_opts = [
> >    NO_INSTALL_OPT,
> >    IGNORE_IPOLICY_OPT,
> >    INSTANCE_COMMUNICATION_OPT,
> > +  HELPER_STARTUP_TIMEOUT_OPT,
> > +  HELPER_SHUTDOWN_TIMEOUT_OPT,
> >    ]
> >
> >  commands = {
> > diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
> > index 380c376..0a16a7d 100644
> > --- a/lib/cmdlib/instance.py
> > +++ b/lib/cmdlib/instance.py
> > @@ -437,6 +437,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)
> > diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> > index 75c2a0f..91d4873 100644
> > --- a/src/Ganeti/Constants.hs
> > +++ b/src/Ganeti/Constants.hs
> > @@ -4926,13 +4926,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)
> > diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs
> > index bf59f61..9eefb61 100644
> > --- a/src/Ganeti/OpCodes.hs
> > +++ b/src/Ganeti/OpCodes.hs
> > @@ -459,6 +459,8 @@ $(genOpCode "OpCode"
> >       , pStartInstance
> >       , pInstTags
> >       , pInstanceCommunication
> > +     , pHelperStartupTimeout
> > +     , pHelperShutdownTimeout
> >       ],
> >       "instance_name")
> >    , ("OpInstanceMultiAlloc",
> > diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs
> > index e22fff9..43faa86 100644
> > --- a/src/Ganeti/OpParams.hs
> > +++ b/src/Ganeti/OpParams.hs
> > @@ -221,6 +221,8 @@ module Ganeti.OpParams
> >    , pX509KeyName
> >    , pX509DestCA
> >    , pZeroFreeSpace
> > +  , pHelperStartupTimeout
> > +  , pHelperShutdownTimeout
> >    , pZeroingTimeoutFixed
> >    , pZeroingTimeoutPerMiB
> >    , pTagSearchPattern
> > @@ -1499,6 +1501,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\
> > @@ -1508,7 +1520,7 @@ pZeroingTimeoutFixed =
> >  pZeroingTimeoutPerMiB :: Field
> >  pZeroingTimeoutPerMiB =
> >    withDoc "The variable part of time to wait before declaring the zeroing\
> > -           \ operation to have failed, dependent on total size of disks" .
> > +           \ operation to have failed, which depends on total size of
> > disks" .
> >    optionalField $ simpleField "zeroing_timeout_per_mib" [t| Double |]
> >
> >  pTagsObject :: Field
> > diff --git a/test/hs/Test/Ganeti/OpCodes.hs
> > b/test/hs/Test/Ganeti/OpCodes.hs
> > index cf8b2df..ad69ad0 100644
> > --- a/test/hs/Test/Ganeti/OpCodes.hs
> > +++ b/test/hs/Test/Ganeti/OpCodes.hs
> > @@ -299,6 +299,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 []
> > --
> > 1.9.1.423.g4596e3a
> >
> >

-- 
Jose Antonio Lopes
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to