LGTM, thanks.

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

> Add assorted, idisk, and inic related constants to the Haskell to
> Python constant generation.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/constants.py          | 71 +++++++++++++------------------------
>  src/Ganeti/HsConstants.hs | 90
> +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 115 insertions(+), 46 deletions(-)
>
> diff --git a/lib/constants.py b/lib/constants.py
> index 81929c4..489fdba 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -805,8 +805,7 @@ OOB_STATUS_CRITICAL = _constants.OOB_STATUS_CRITICAL
>  OOB_STATUS_UNKNOWN = _constants.OOB_STATUS_UNKNOWN
>  OOB_STATUSES = _constants.OOB_STATUSES
>
> -# Instance Parameters Profile
> -PP_DEFAULT = "default"
> +PP_DEFAULT = _constants.PP_DEFAULT
>
>  NIC_MODE = _constants.NIC_MODE
>  NIC_LINK = _constants.NIC_LINK
> @@ -820,50 +819,30 @@ NIC_MODE_OVS = _constants.NIC_MODE_OVS
>  NIC_IP_POOL = _constants.NIC_IP_POOL
>  NIC_VALID_MODES = _constants.NIC_VALID_MODES
>
> -RESERVE_ACTION = "reserve"
> -RELEASE_ACTION = "release"
> -
> -# IDISK_* constants are used in opcodes, to create/change disks
> -IDISK_SIZE = "size"
> -IDISK_SPINDLES = "spindles"
> -IDISK_MODE = "mode"
> -IDISK_ADOPT = "adopt"
> -IDISK_VG = "vg"
> -IDISK_METAVG = "metavg"
> -IDISK_PROVIDER = "provider"
> -IDISK_NAME = "name"
> -IDISK_PARAMS_TYPES = {
> -  IDISK_SIZE: VTYPE_SIZE,
> -  IDISK_SPINDLES: VTYPE_INT,
> -  IDISK_MODE: VTYPE_STRING,
> -  IDISK_ADOPT: VTYPE_STRING,
> -  IDISK_VG: VTYPE_STRING,
> -  IDISK_METAVG: VTYPE_STRING,
> -  IDISK_PROVIDER: VTYPE_STRING,
> -  IDISK_NAME: VTYPE_MAYBE_STRING,
> -  }
> -IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
> -
> -# INIC_* constants are used in opcodes, to create/change nics
> -INIC_MAC = "mac"
> -INIC_IP = "ip"
> -INIC_MODE = "mode"
> -INIC_LINK = "link"
> -INIC_NETWORK = "network"
> -INIC_NAME = "name"
> -INIC_VLAN = "vlan"
> -INIC_BRIDGE = "bridge"
> -INIC_PARAMS_TYPES = {
> -  INIC_IP: VTYPE_MAYBE_STRING,
> -  INIC_LINK: VTYPE_STRING,
> -  INIC_MAC: VTYPE_STRING,
> -  INIC_MODE: VTYPE_STRING,
> -  INIC_NETWORK: VTYPE_MAYBE_STRING,
> -  INIC_NAME: VTYPE_MAYBE_STRING,
> -  INIC_VLAN: VTYPE_MAYBE_STRING,
> -  INIC_BRIDGE: VTYPE_MAYBE_STRING
> -  }
> -INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
> +RESERVE_ACTION = _constants.RESERVE_ACTION
> +RELEASE_ACTION = _constants.RELEASE_ACTION
> +
> +IDISK_SIZE = _constants.IDISK_SIZE
> +IDISK_SPINDLES = _constants.IDISK_SPINDLES
> +IDISK_MODE = _constants.IDISK_MODE
> +IDISK_ADOPT = _constants.IDISK_ADOPT
> +IDISK_VG = _constants.IDISK_VG
> +IDISK_METAVG = _constants.IDISK_METAVG
> +IDISK_PROVIDER = _constants.IDISK_PROVIDER
> +IDISK_NAME = _constants.IDISK_NAME
> +IDISK_PARAMS_TYPES = _constants.IDISK_PARAMS_TYPES
> +IDISK_PARAMS = _constants.IDISK_PARAMS
> +
> +INIC_MAC = _constants.INIC_MAC
> +INIC_IP = _constants.INIC_IP
> +INIC_MODE = _constants.INIC_MODE
> +INIC_LINK = _constants.INIC_LINK
> +INIC_NETWORK = _constants.INIC_NETWORK
> +INIC_NAME = _constants.INIC_NAME
> +INIC_VLAN = _constants.INIC_VLAN
> +INIC_BRIDGE = _constants.INIC_BRIDGE
> +INIC_PARAMS_TYPES = _constants.INIC_PARAMS_TYPES
> +INIC_PARAMS = _constants.INIC_PARAMS
>
>  # Hypervisor constants
>  HT_XEN_PVM = _constants.HT_XEN_PVM
> diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs
> index b6ae2d2..4e78db8 100644
> --- a/src/Ganeti/HsConstants.hs
> +++ b/src/Ganeti/HsConstants.hs
> @@ -2096,6 +2096,10 @@ oobStatusWarning = Types.oobStatusToRaw
> OobStatusWarning
>  oobStatuses :: FrozenSet String
>  oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
>
> +-- | Instance Parameters Profile
> +ppDefault :: String
> +ppDefault = "default"
> +
>  -- * nic* constants are used inside the ganeti config
>
>  nicLink :: String
> @@ -2131,6 +2135,92 @@ nicIpPool = Types.nICModeToRaw NMPool
>  nicValidModes :: FrozenSet String
>  nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
>
> +releaseAction :: String
> +releaseAction = "release"
> +
> +reserveAction :: String
> +reserveAction = "reserve"
> +
> +-- * idisk* constants are used in opcodes, to create/change disks
> +
> +idiskAdopt :: String
> +idiskAdopt = "adopt"
> +
> +idiskMetavg :: String
> +idiskMetavg = "metavg"
> +
> +idiskMode :: String
> +idiskMode = "mode"
> +
> +idiskName :: String
> +idiskName = "name"
> +
> +idiskSize :: String
> +idiskSize = "size"
> +
> +idiskSpindles :: String
> +idiskSpindles = "spindles"
> +
> +idiskVg :: String
> +idiskVg = "vg"
> +
> +idiskProvider :: String
> +idiskProvider = "provider"
> +
> +idiskParamsTypes :: Map String VType
> +idiskParamsTypes =
> +  Map.fromList [(idiskSize, VTypeSize),
> +                (idiskSpindles, VTypeInt),
> +                (idiskMode, VTypeString),
> +                (idiskAdopt, VTypeString),
> +                (idiskVg, VTypeString),
> +                (idiskMetavg, VTypeString),
> +                (idiskProvider, VTypeString),
> +                (idiskName, VTypeMaybeString)]
> +
> +idiskParams :: FrozenSet String
> +idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
> +
> +-- * inic* constants are used in opcodes, to create/change nics
> +
> +inicBridge :: String
> +inicBridge = "bridge"
> +
> +inicIp :: String
> +inicIp = "ip"
> +
> +inicLink :: String
> +inicLink = "link"
> +
> +inicMac :: String
> +inicMac = "mac"
> +
> +inicMode :: String
> +inicMode = "mode"
> +
> +inicName :: String
> +inicName = "name"
> +
> +inicNetwork :: String
> +inicNetwork = "network"
> +
> +inicVlan :: String
> +inicVlan = "vlan"
> +
> +inicParamsTypes :: Map String VType
> +inicParamsTypes =
> +  Map.fromList [(inicBridge, VTypeMaybeString),
> +                (inicIp, VTypeMaybeString),
> +                (inicLink, VTypeString),
> +                (inicMac, VTypeString),
> +                (inicMode, VTypeString),
> +                (inicName, VTypeMaybeString),
> +                (inicNetwork, VTypeMaybeString),
> +                (inicVlan, VTypeMaybeString)]
> +
> +inicParams :: FrozenSet String
> +inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
> +
>  -- * Hypervisor constants
>
>  htXenPvm :: String
> --
> 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