On Mon, Oct 7, 2013 at 4:38 PM, Jose A. Lopes <[email protected]> wrote:

> Add SSL, job queue, and locks related constants to the Haskell to Python
> constant generation.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/constants.py          | 33 ++++++++++++-------------------
>  src/Ganeti/HsConstants.hs | 49
> +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+), 21 deletions(-)
>
> diff --git a/lib/constants.py b/lib/constants.py
> index 9b7b9a7..075ae8f 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -1116,9 +1116,8 @@ NR_DRAINED = _constants.NR_DRAINED
>  NR_OFFLINE = _constants.NR_OFFLINE
>  NR_ALL = _constants.NR_ALL
>
> -# SSL certificate check constants (in days)
> -SSL_CERT_EXPIRATION_WARN = 30
> -SSL_CERT_EXPIRATION_ERROR = 7
> +SSL_CERT_EXPIRATION_WARN = _constants.SSL_CERT_EXPIRATION_WARN
> +SSL_CERT_EXPIRATION_ERROR = _constants.SSL_CERT_EXPIRATION_ERROR
>
>  # Allocator framework constants
>  IALLOCATOR_VERSION = _constants.IALLOCATOR_VERSION
> @@ -1142,16 +1141,14 @@ NODE_EVAC_SEC = _constants.NODE_EVAC_SEC
>  NODE_EVAC_ALL = _constants.NODE_EVAC_ALL
>  NODE_EVAC_MODES = _constants.NODE_EVAC_MODES
>
> -# Job queue
> -JOB_QUEUE_VERSION = 1
> -JOB_QUEUE_SIZE_HARD_LIMIT = 5000
> -JOB_QUEUE_FILES_PERMS = 0640
> +JOB_QUEUE_VERSION = _constants.JOB_QUEUE_VERSION
> +JOB_QUEUE_SIZE_HARD_LIMIT = _constants.JOB_QUEUE_SIZE_HARD_LIMIT
> +JOB_QUEUE_FILES_PERMS = _constants.JOB_QUEUE_FILES_PERMS
>
>  JOB_ID_TEMPLATE = r"\d+"
>  JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
>
> -# unchanged job return
> -JOB_NOTCHANGED = "nochange"
> +JOB_NOTCHANGED = _constants.JOB_NOTCHANGED
>
>  # Job status
>  JOB_STATUS_QUEUED = _constants.JOB_STATUS_QUEUED
> @@ -1186,18 +1183,12 @@ OP_PRIO_HIGH = _constants.OP_PRIO_HIGH
>  OP_PRIO_SUBMIT_VALID = _constants.OP_PRIO_SUBMIT_VALID
>  OP_PRIO_DEFAULT = _constants.OP_PRIO_DEFAULT
>
> -# Lock recalculate mode
> -LOCKS_REPLACE = "replace"
> -LOCKS_APPEND = "append"
> -
> -# Lock timeout (sum) before we should go into blocking acquire (still
> -# can be reset by priority change); computed as max time (10 hours)
> -# before we should actually go into blocking acquire given that we
> -# start from default priority level; in seconds
> -# TODO
> -LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
> -LOCK_ATTEMPTS_MAXWAIT = 15.0
> -LOCK_ATTEMPTS_MINWAIT = 1.0
> +LOCKS_REPLACE = _constants.LOCKS_REPLACE
> +LOCKS_APPEND = _constants.LOCKS_APPEND
> +
> +LOCK_ATTEMPTS_TIMEOUT = _constants.LOCK_ATTEMPTS_TIMEOUT
> +LOCK_ATTEMPTS_MAXWAIT = _constants.LOCK_ATTEMPTS_MAXWAIT
> +LOCK_ATTEMPTS_MINWAIT = _constants.LOCK_ATTEMPTS_MINWAIT
>
>  # Execution log types
>  ELOG_MESSAGE = _constants.ELOG_MESSAGE
> diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs
> index ecd8465..63a4e75 100644
> --- a/src/Ganeti/HsConstants.hs
> +++ b/src/Ganeti/HsConstants.hs
> @@ -2701,6 +2701,14 @@ nrRegular = Types.nodeRoleToRaw NRRegular
>  nrAll :: FrozenSet String
>  nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
>
> +-- * SSL certificate check constants (in days)
> +
> +sslCertExpirationError :: Int
> +sslCertExpirationError = 7
> +
> +sslCertExpirationWarn :: Int
> +sslCertExpirationWarn = 30
> +
>  -- * Allocator framework constants
>
>  iallocatorVersion :: Int
> @@ -2755,6 +2763,22 @@ nodeEvacAll = Types.evacModeToRaw ChangeAll
>  nodeEvacModes :: FrozenSet String
>  nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
>
> +-- * Job queue
> +
> +jobQueueVersion :: Int
> +jobQueueVersion = 1
> +
> +jobQueueSizeHardLimit :: Int
> +jobQueueSizeHardLimit = 5000
> +
> +jobQueueFilesPerms :: Int
> +jobQueueFilesPerms = 0o640
> +
> +-- * Unchanged job return
> +
> +jobNotchanged :: String
> +jobNotchanged = "nochange"
> +
>  -- * Job status
>
>  jobStatusQueued :: String
> @@ -2843,6 +2867,31 @@ opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow,
> opPrioNormal, opPrioHigh]
>  opPrioDefault :: Int
>  opPrioDefault = opPrioNormal
>
> +-- * Lock recalculate mode
> +
> +locksAppend :: String
> +locksAppend = "append"
> +
> +locksReplace :: String
> +locksReplace = "replace"
> +
> +-- * Lock timeout
> +--
> +-- Lock timeout (sum) before we should go into blocking acquire (still
> +-- can be reset by priority change); computed as max time (10 hours)
> +-- before we should actually go into blocking acquire given that we
> +-- start from default priority level; in seconds
> +-- TODO
>

I know, this TODO is copied from Python. But it still does not make sense...


> +
> +lockAttemptsMaxwait :: Double
> +lockAttemptsMaxwait = 15.0
> +
> +lockAttemptsMinwait :: Double
> +lockAttemptsMinwait = 1.0
> +
> +lockAttemptsTimeout :: Int
> +lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
> +
>  -- * Execution log types
>
>  elogMessage :: String
> --
> 1.8.4
>
>
Rest LGTM, thanks.



-- 
Thomas Thrainer | Software Engineer | [email protected] |

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

Reply via email to