* Add type 'AdminStateSource' which keeps track of who last changed the instance field 'admin_state': the admin or the user.
* Add constants 'adminSource', 'userSource', and 'adminStateSources', which are needed by the instance shutdown opcode and LU in Python. * Add type predicate 'TAdminStateSource', which is needed by the opcode parameter. Signed-off-by: Jose A. Lopes <[email protected]> --- lib/ht.py | 1 + src/Ganeti/Constants.hs | 11 +++++++++++ src/Ganeti/Types.hs | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/lib/ht.py b/lib/ht.py index 500c391..2a50761 100644 --- a/lib/ht.py +++ b/lib/ht.py @@ -541,6 +541,7 @@ TEvacMode = TElemOf(constants.NODE_EVAC_MODES) TIAllocatorTestDir = TElemOf(constants.VALID_IALLOCATOR_DIRECTIONS) TIAllocatorMode = TElemOf(constants.VALID_IALLOCATOR_MODES) TImportExportCompression = TElemOf(constants.IEC_ALL) +TAdminStateSource = TElemOf(constants.ADMIN_STATE_SOURCES) def TSetParamsMods(fn): diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs index 9270ec2..c13d6d6 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -3119,6 +3119,17 @@ adminstUp = Types.adminStateToRaw AdminUp adminstAll :: FrozenSet String adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..] +-- * Admin state sources + +adminSource :: AdminStateSource +adminSource = AdminSource + +userSource :: AdminStateSource +userSource = UserSource + +adminStateSources :: FrozenSet AdminStateSource +adminStateSources = ConstantUtils.mkSet [minBound..] + -- * Node roles nrDrained :: String diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs index f3bd4af..38d71b3 100644 --- a/src/Ganeti/Types.hs +++ b/src/Ganeti/Types.hs @@ -140,6 +140,9 @@ module Ganeti.Types , AdminState(..) , adminStateFromRaw , adminStateToRaw + , AdminStateSource(..) + , adminStateSourceFromRaw + , adminStateSourceToRaw , StorageField(..) , storageFieldToRaw , DiskAccessMode(..) @@ -806,6 +809,15 @@ $(THH.declareLADT ''String "AdminState" ]) $(THH.makeJSONInstance ''AdminState) +$(THH.declareLADT ''String "AdminStateSource" + [ ("AdminSource", "admin") + , ("UserSource", "user") + ]) +$(THH.makeJSONInstance ''AdminStateSource) + +instance THH.PyValue AdminStateSource where + showValue = THH.showValue . adminStateSourceToRaw + -- * Storage field type $(THH.declareLADT ''String "StorageField" -- 1.9.1.423.g4596e3a
