Revision a5728081
ID | a5728081faa3068dcb797a7ccccd9ce47c0b23e0 |
Instance parameters: force typing
We want all the hv/be parameters to have a known type, rather than a
random mix of empty string, boolean values, and None, so we declare the
type of each variable and we enforce/convert it.
- Add some new constants for enforceable value types
- Add new constants dicts HVS_PARAMETER_TYPES and BES_PARAMETER_TYPES
holding not only the valid parameters but also their types
- Drop the old HVS_PARAMETERS and BES_PARAMETERS constants and calculate
the values from the type dict
- Convert all the default parameters to a valid type value
- Create a new ForceDictType utils function, to check/enforce a dict's
element value types, with relevant unit tests
- Drop a few custom functions to check/convert the BE param types in
utils and cli, in favor of ForceDictType
- Double-check the parameter types using ForceDictType in both scripts
and LogicalUnits, when possible.
As a bonus:
- Remove some old commented-out code in gnt-instance
- Remove some already fixed FIXME
- Fix a bug which prevented VALUE_DEFAULT to be applied to BE parameters
in SetInstanceParams because the value was checked for validity before
that transformation was made
- Fix a bug which prevented initing a cluster and passing hvparams to
work at all
- ForceDictType allows an allowed_values for exceptions, which makes us
able to do the checking even when some values must not be
converted/typechecked (for example the 'default' string in
SetInstanceParameters)
Reviewed-by: iustinp
Files
- added
- modified
- copied
- renamed
- deleted