LGTM, thanks.

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

> Add backend and logical disks related constants to the Haskell to
> Python constant generation.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/constants.py          |  99 ++++++++++++--------------------------
>  src/Ganeti/HsConstants.hs | 119
> ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 149 insertions(+), 69 deletions(-)
>
> diff --git a/lib/constants.py b/lib/constants.py
> index 0ca1659..12e5698 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -697,6 +697,18 @@ DSS_PARAMETER_TYPES = _constants.DSS_PARAMETER_TYPES
>  DSS_PARAMETERS = _constants.DSS_PARAMETERS
>  DS_VALID_TYPES = _constants.DS_VALID_TYPES
>
> +BE_MEMORY = _constants.BE_MEMORY
> +BE_MAXMEM = _constants.BE_MAXMEM
> +BE_MINMEM = _constants.BE_MINMEM
> +BE_VCPUS = _constants.BE_VCPUS
> +BE_AUTO_BALANCE = _constants.BE_AUTO_BALANCE
> +BE_ALWAYS_FAILOVER = _constants.BE_ALWAYS_FAILOVER
> +BE_SPINDLE_USE = _constants.BE_SPINDLE_USE
> +BES_PARAMETER_TYPES = _constants.BES_PARAMETER_TYPES
> +BES_PARAMETER_TITLES = _constants.BES_PARAMETER_TITLES
> +BES_PARAMETER_COMPAT = _constants.BES_PARAMETER_COMPAT
> +BES_PARAMETERS = _constants.BES_PARAMETERS
> +
>  ISPEC_MEM_SIZE = _constants.ISPEC_MEM_SIZE
>  ISPEC_CPU_COUNT = _constants.ISPEC_CPU_COUNT
>  ISPEC_DISK_COUNT = _constants.ISPEC_DISK_COUNT
> @@ -728,75 +740,24 @@ NDS_PARAMETER_TYPES = _constants.NDS_PARAMETER_TYPES
>  NDS_PARAMETERS = _constants.NDS_PARAMETERS
>  NDS_PARAMETER_TITLES = _constants.NDS_PARAMETER_TITLES
>
> -
> -# Backend parameter names
> -BE_MEMORY = "memory" # deprecated and replaced by max and min mem
> -BE_MAXMEM = "maxmem"
> -BE_MINMEM = "minmem"
> -BE_VCPUS = "vcpus"
> -BE_AUTO_BALANCE = "auto_balance"
> -BE_ALWAYS_FAILOVER = "always_failover"
> -BE_SPINDLE_USE = "spindle_use"
> -
> -BES_PARAMETER_TYPES = {
> -  BE_MAXMEM: VTYPE_SIZE,
> -  BE_MINMEM: VTYPE_SIZE,
> -  BE_VCPUS: VTYPE_INT,
> -  BE_AUTO_BALANCE: VTYPE_BOOL,
> -  BE_ALWAYS_FAILOVER: VTYPE_BOOL,
> -  BE_SPINDLE_USE: VTYPE_INT,
> -  }
> -
> -BES_PARAMETER_TITLES = {
> -  BE_AUTO_BALANCE: "Auto_balance",
> -  BE_MAXMEM: "ConfigMaxMem",
> -  BE_MINMEM: "ConfigMinMem",
> -  BE_VCPUS: "ConfigVCPUs",
> -  }
> -
> -BES_PARAMETER_COMPAT = {
> -  BE_MEMORY: VTYPE_SIZE,
> -  }
> -BES_PARAMETER_COMPAT.update(BES_PARAMETER_TYPES)
> -
> -BES_PARAMETERS = frozenset(BES_PARAMETER_TYPES.keys())
> -
> -# Logical Disks parameters
> -LDP_RESYNC_RATE = "resync-rate"
> -LDP_STRIPES = "stripes"
> -LDP_BARRIERS = "disabled-barriers"
> -LDP_NO_META_FLUSH = "disable-meta-flush"
> -LDP_DEFAULT_METAVG = "default-metavg"
> -LDP_DISK_CUSTOM = "disk-custom"
> -LDP_NET_CUSTOM = "net-custom"
> -LDP_PROTOCOL = "protocol"
> -LDP_DYNAMIC_RESYNC = "dynamic-resync"
> -LDP_PLAN_AHEAD = "c-plan-ahead"
> -LDP_FILL_TARGET = "c-fill-target"
> -LDP_DELAY_TARGET = "c-delay-target"
> -LDP_MAX_RATE = "c-max-rate"
> -LDP_MIN_RATE = "c-min-rate"
> -LDP_POOL = "pool"
> -LDP_ACCESS = "access"
> -DISK_LD_TYPES = {
> -  LDP_RESYNC_RATE: VTYPE_INT,
> -  LDP_STRIPES: VTYPE_INT,
> -  LDP_BARRIERS: VTYPE_STRING,
> -  LDP_NO_META_FLUSH: VTYPE_BOOL,
> -  LDP_DEFAULT_METAVG: VTYPE_STRING,
> -  LDP_DISK_CUSTOM: VTYPE_STRING,
> -  LDP_NET_CUSTOM: VTYPE_STRING,
> -  LDP_PROTOCOL: VTYPE_STRING,
> -  LDP_DYNAMIC_RESYNC: VTYPE_BOOL,
> -  LDP_PLAN_AHEAD: VTYPE_INT,
> -  LDP_FILL_TARGET: VTYPE_INT,
> -  LDP_DELAY_TARGET: VTYPE_INT,
> -  LDP_MAX_RATE: VTYPE_INT,
> -  LDP_MIN_RATE: VTYPE_INT,
> -  LDP_POOL: VTYPE_STRING,
> -  LDP_ACCESS: VTYPE_STRING,
> -  }
> -DISK_LD_PARAMETERS = frozenset(DISK_LD_TYPES.keys())
> +LDP_RESYNC_RATE = _constants.LDP_RESYNC_RATE
> +LDP_STRIPES = _constants.LDP_STRIPES
> +LDP_BARRIERS = _constants.LDP_BARRIERS
> +LDP_NO_META_FLUSH = _constants.LDP_NO_META_FLUSH
> +LDP_DEFAULT_METAVG = _constants.LDP_DEFAULT_METAVG
> +LDP_DISK_CUSTOM = _constants.LDP_DISK_CUSTOM
> +LDP_NET_CUSTOM = _constants.LDP_NET_CUSTOM
> +LDP_PROTOCOL = _constants.LDP_PROTOCOL
> +LDP_DYNAMIC_RESYNC = _constants.LDP_DYNAMIC_RESYNC
> +LDP_PLAN_AHEAD = _constants.LDP_PLAN_AHEAD
> +LDP_FILL_TARGET = _constants.LDP_FILL_TARGET
> +LDP_DELAY_TARGET = _constants.LDP_DELAY_TARGET
> +LDP_MAX_RATE = _constants.LDP_MAX_RATE
> +LDP_MIN_RATE = _constants.LDP_MIN_RATE
> +LDP_POOL = _constants.LDP_POOL
> +LDP_ACCESS = _constants.LDP_ACCESS
> +DISK_LD_TYPES = _constants.DISK_LD_TYPES
> +DISK_LD_PARAMETERS = _constants.DISK_LD_PARAMETERS
>
>  # Disk template parameters (can be set/changed by the user via
> gnt-cluster and
>  # gnt-group)
> diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs
> index f9de1f3..6421d0d 100644
> --- a/src/Ganeti/HsConstants.hs
> +++ b/src/Ganeti/HsConstants.hs
> @@ -1705,6 +1705,58 @@ dssParameters =
>  dsValidTypes :: FrozenSet String
>  dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
>
> +-- Backend parameter names
> +
> +beAlwaysFailover :: String
> +beAlwaysFailover = "always_failover"
> +
> +beAutoBalance :: String
> +beAutoBalance = "auto_balance"
> +
> +beMaxmem :: String
> +beMaxmem = "maxmem"
> +
> +-- | Deprecated and replaced by max and min mem
> +beMemory :: String
> +beMemory = "memory"
> +
> +beMinmem :: String
> +beMinmem = "minmem"
> +
> +beSpindleUse :: String
> +beSpindleUse = "spindle_use"
> +
> +beVcpus :: String
> +beVcpus = "vcpus"
> +
> +besParameterTypes :: Map String VType
> +besParameterTypes =
> +  Map.fromList [(beAlwaysFailover, VTypeBool),
> +                (beAutoBalance, VTypeBool),
> +                (beMaxmem, VTypeSize),
> +                (beMinmem, VTypeSize),
> +                (beSpindleUse, VTypeInt),
> +                (beVcpus, VTypeInt)]
> +
> +besParameterTitles :: Map String String
> +besParameterTitles =
> +  Map.fromList [(beAutoBalance, "Auto_balance"),
> +                (beMinmem, "ConfigMinMem"),
> +                (beVcpus, "ConfigVCPUs"),
> +                (beMaxmem, "ConfigMaxMem")]
> +
> +besParameterCompat :: Map String VType
> +besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
> +
> +besParameters :: FrozenSet String
> +besParameters =
> +  ConstantUtils.mkSet [beAlwaysFailover,
> +                       beAutoBalance,
> +                       beMaxmem,
> +                       beMinmem,
> +                       beSpindleUse,
> +                       beVcpus]
> +
>  -- | Instance specs
>  --
>  -- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
> @@ -1825,11 +1877,78 @@ ndsParameterTitles =
>     (ndOvsName, "OpenvSwitchName"),
>     (ndSpindleCount, "SpindleCount")]
>
> +-- * Logical Disks parameters
> +
> +ldpAccess :: String
> +ldpAccess = "access"
> +
> +ldpBarriers :: String
> +ldpBarriers = "disabled-barriers"
> +
> +ldpDefaultMetavg :: String
> +ldpDefaultMetavg = "default-metavg"
> +
> +ldpDelayTarget :: String
> +ldpDelayTarget = "c-delay-target"
> +
> +ldpDiskCustom :: String
> +ldpDiskCustom = "disk-custom"
> +
> +ldpDynamicResync :: String
> +ldpDynamicResync = "dynamic-resync"
>
> +ldpFillTarget :: String
> +ldpFillTarget = "c-fill-target"
>
> +ldpMaxRate :: String
> +ldpMaxRate = "c-max-rate"
>
> +ldpMinRate :: String
> +ldpMinRate = "c-min-rate"
>
> +ldpNetCustom :: String
> +ldpNetCustom = "net-custom"
>
> +ldpNoMetaFlush :: String
> +ldpNoMetaFlush = "disable-meta-flush"
> +
> +ldpPlanAhead :: String
> +ldpPlanAhead = "c-plan-ahead"
> +
> +ldpPool :: String
> +ldpPool = "pool"
> +
> +ldpProtocol :: String
> +ldpProtocol = "protocol"
> +
> +ldpResyncRate :: String
> +ldpResyncRate = "resync-rate"
> +
> +ldpStripes :: String
> +ldpStripes = "stripes"
> +
> +diskLdTypes :: Map String VType
> +diskLdTypes =
> +  Map.fromList
> +  [(ldpAccess, VTypeString),
> +   (ldpResyncRate, VTypeInt),
> +   (ldpStripes, VTypeInt),
> +   (ldpBarriers, VTypeString),
> +   (ldpNoMetaFlush, VTypeBool),
> +   (ldpDefaultMetavg, VTypeString),
> +   (ldpDiskCustom, VTypeString),
> +   (ldpNetCustom, VTypeString),
> +   (ldpProtocol, VTypeString),
> +   (ldpDynamicResync, VTypeBool),
> +   (ldpPlanAhead, VTypeInt),
> +   (ldpFillTarget, VTypeInt),
> +   (ldpDelayTarget, VTypeInt),
> +   (ldpMaxRate, VTypeInt),
> +   (ldpMinRate, VTypeInt),
> +   (ldpPool, VTypeString)]
> +
> +diskLdParameters :: FrozenSet String
> +diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
>
>  -- * OOB supported commands
>
> --
> 1.8.4
>
>


-- 
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