diff --git a/Ganeti/HTools/Instance.hs b/Ganeti/HTools/Instance.hs index d14ad933d8e23ae4ed19e675c39c99ffd03535ea..c091f62a9a9c96e80b4f607726e0b5ac8d15f54b 100644 --- a/Ganeti/HTools/Instance.hs +++ b/Ganeti/HTools/Instance.hs @@ -39,6 +39,7 @@ module Ganeti.HTools.Instance , setMovable , specOf , shrinkByType + , runningStates ) where import qualified Ganeti.HTools.Types as T @@ -77,6 +78,10 @@ unitDsk = 256 unitCpu :: Int unitCpu = 1 +-- | Running instance states. +runningStates :: [String] +runningStates = ["running", "ERROR_up"] + -- | A simple name for the int, instance association list. type AssocList = [(T.Idx, Instance)] @@ -96,7 +101,7 @@ create name_init mem_init dsk_init vcpus_init run_init tags_init pn sn = , mem = mem_init , dsk = dsk_init , vcpus = vcpus_init - , running = run_init == "running" || run_init == "ERROR_up" + , running = run_init `elem` runningStates , runSt = run_init , pNode = pn , sNode = sn diff --git a/Ganeti/HTools/QC.hs b/Ganeti/HTools/QC.hs index 35c4b1e71fcd2bda9570d72d377b24e8ab3f3e48..c23e81db1ad153b51aed716d54bea8aa51406648 100644 --- a/Ganeti/HTools/QC.hs +++ b/Ganeti/HTools/QC.hs @@ -170,13 +170,13 @@ prop_Instance_runStatus_True inst = let run_st = Instance.running inst run_tx = Instance.runSt inst in - run_tx == "running" || run_tx == "ERROR_up" ==> run_st + run_tx `elem` Instance.runningStates ==> run_st prop_Instance_runStatus_False inst = let run_st = Instance.running inst run_tx = Instance.runSt inst in - run_tx /= "running" && run_tx /= "ERROR_up" ==> not run_st + run_tx `notElem` Instance.runningStates ==> not run_st testInstance = [ run prop_Instance_setIdx