From 1fe412bb9ec1b5666d4a32b1ee499c14c191e563 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 29 Jun 2011 18:02:44 +0200 Subject: [PATCH] htools: introduce new data type for node-evac 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 | 2 ++ htools/Ganeti/HTools/Types.hs | 7 +++++++ htools/hail.hs | 1 + 3 files changed, 10 insertions(+) diff --git a/htools/Ganeti/HTools/Loader.hs b/htools/Ganeti/HTools/Loader.hs index 89b479d8e..7331a59a3 100644 --- a/htools/Ganeti/HTools/Loader.hs +++ b/htools/Ganeti/HTools/Loader.hs @@ -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. diff --git a/htools/Ganeti/HTools/Types.hs b/htools/Ganeti/HTools/Types.hs index be7ec18fc..0c5941090 100644 --- a/htools/Ganeti/HTools/Types.hs +++ b/htools/Ganeti/HTools/Types.hs @@ -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) diff --git a/htools/hail.hs b/htools/hail.hs index 7a1c6817e..86f672757 100644 --- a/htools/hail.hs +++ b/htools/hail.hs @@ -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 -- GitLab