Commit e82271f8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Replace instance states hardcoded with constants


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent df5227dc
......@@ -45,6 +45,7 @@ module Ganeti.HTools.Instance
import qualified Ganeti.HTools.Types as T
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.Constants as C
-- * Type declarations
......@@ -75,7 +76,7 @@ instance T.Element Instance where
-- | Running instance states.
runningStates :: [String]
runningStates = ["running", "ERROR_up"]
runningStates = [C.inststRunning, C.inststErrorup]
-- | A simple name for the int, instance association list.
type AssocList = [(T.Idx, Instance)]
......
......@@ -64,6 +64,7 @@ import qualified Ganeti.HTools.Text as Text
import qualified Ganeti.HTools.Types as Types
import qualified Ganeti.HTools.Utils as Utils
import qualified Ganeti.HTools.Version
import qualified Ganeti.Constants as C
-- * Constants
......@@ -177,10 +178,14 @@ instance Arbitrary Instance.Instance where
name <- getFQDN
mem <- choose (0, maxMem)
dsk <- choose (0, maxDsk)
run_st <- elements ["ERROR_up", "ERROR_down", "ADMIN_down"
, "ERROR_nodedown", "ERROR_nodeoffline"
, "running"
, "no_such_status1", "no_such_status2"]
run_st <- elements [ C.inststErrorup
, C.inststErrordown
, C.inststAdmindown
, C.inststNodedown
, C.inststNodeoffline
, C.inststRunning
, "no_such_status1"
, "no_such_status2"]
pn <- arbitrary
sn <- arbitrary
vcpus <- choose (0, maxCpu)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment