htools: create InstanceStatus ADT
authorAgata Murawska <agatamurawska@google.com>
Thu, 10 Nov 2011 10:10:13 +0000 (11:10 +0100)
committerAgata Murawska <agatamurawska@google.com>
Wed, 16 Nov 2011 13:15:51 +0000 (14:15 +0100)
Signed-off-by: Agata Murawska <agatamurawska@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

htools/Ganeti/HTools/Types.hs

index a7d7130..a3719d8 100644 (file)
@@ -36,6 +36,9 @@ module Ganeti.HTools.Types
     , AllocPolicy(..)
     , allocPolicyFromRaw
     , allocPolicyToRaw
+    , InstanceStatus(..)
+    , instanceStatusFromRaw
+    , instanceStatusToRaw
     , RSpec(..)
     , DynUtil(..)
     , zeroUtil
@@ -110,6 +113,19 @@ $(THH.declareSADT "AllocPolicy"
          ])
 $(THH.makeJSONInstance ''AllocPolicy)
 
+-- | The Instance real state type.
+$(THH.declareSADT "InstanceStatus"
+         [ ("AdminDown", 'C.inststAdmindown)
+         , ("AdminOffline", 'C.inststAdminoffline)
+         , ("ErrorDown", 'C.inststErrordown)
+         , ("ErrorUp", 'C.inststErrorup)
+         , ("NodeDown", 'C.inststNodedown)
+         , ("NodeOffline", 'C.inststNodeoffline)
+         , ("Running", 'C.inststRunning)
+         , ("WrongNode", 'C.inststWrongnode)
+         ])
+$(THH.makeJSONInstance ''InstanceStatus)
+
 -- | The resource spec type.
 data RSpec = RSpec
     { rspecCpu  :: Int  -- ^ Requested VCPUs