htools: introduce new data type for node-evac
authorIustin Pop <iustin@google.com>
Wed, 29 Jun 2011 16:02:44 +0000 (18:02 +0200)
committerIustin Pop <iustin@google.com>
Wed, 13 Jul 2011 10:02:53 +0000 (12:02 +0200)
The evac-mode goes into the Types.hs module since it needs to be
available to Cluster.hs too.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

htools/Ganeti/HTools/Loader.hs
htools/Ganeti/HTools/Types.hs
htools/hail.hs

index 89b479d..7331a59 100644 (file)
@@ -35,6 +35,7 @@ module Ganeti.HTools.Loader
     , lookupGroup
     , commonSuffix
     , RelocMode(..)
+    , EvacMode(..)
     , RqType(..)
     , Request(..)
     , ClusterData(..)
@@ -78,6 +79,7 @@ data RqType
                                      -- secondary node
     | Evacuate [Ndx]                 -- ^ Evacuate nodes
     | MultiReloc [Idx] RelocMode     -- ^ Multi-relocate mode
+    | NodeEvacuate [Idx] EvacMode    -- ^ node-evacuate mode
     deriving (Show, Read)
 
 -- | A complete request, as received from Ganeti.
index be7ec18..0c59410 100644 (file)
@@ -59,6 +59,7 @@ module Ganeti.HTools.Types
     , OpResult(..)
     , connTimeout
     , queryTimeout
+    , EvacMode(..)
     ) where
 
 import qualified Data.Map as M
@@ -279,3 +280,9 @@ class Element a where
               name = nameOf e
     -- | Updates the index of the element
     setIdx  :: a -> Int -> a
+
+-- | The iallocator node-evacuate evac_mode type.
+data EvacMode = ChangePrimary
+              | ChangeSecondary
+              | ChangeAll
+                deriving (Show, Read)
index 7a1c681..86f6727 100644 (file)
@@ -76,6 +76,7 @@ processRequest request =
                                     idx reqn exnodes
        Evacuate exnodes -> Cluster.tryMGEvac gl nl il exnodes
        MultiReloc _ _ -> fail "multi-reloc not handled"
+       NodeEvacuate _ _ -> fail "node-evacuate not handled"
 
 -- | Reads the request from the data file(s)
 readRequest :: Options -> [String] -> IO Request