diff --git a/Ganeti/HTools/IAlloc.hs b/Ganeti/HTools/IAlloc.hs index bbeb868b233c25cc926dacc98a7744c82cfca844..d13d568cefedad24a3d70a93f723cf82e0f4f1a6 100644 --- a/Ganeti/HTools/IAlloc.hs +++ b/Ganeti/HTools/IAlloc.hs @@ -3,11 +3,8 @@ -} module Ganeti.HTools.IAlloc - ( - parseData + ( parseData , formatResponse - , RqType(..) - , Request(..) ) where import Data.Either () @@ -22,17 +19,6 @@ import Ganeti.HTools.Loader import Ganeti.HTools.Utils import Ganeti.HTools.Types --- | The request type. -data RqType - = Allocate Instance.Instance Int -- ^ A new instance allocation - | Relocate Idx Int [Ndx] -- ^ Move an instance to a new - -- secondary node - deriving (Show) - --- | A complete request, as received from Ganeti. -data Request = Request RqType Node.List Instance.List String - deriving (Show) - -- | Parse the basic specifications of an instance. -- -- Instances in the cluster instance list and the instance in an diff --git a/Ganeti/HTools/Loader.hs b/Ganeti/HTools/Loader.hs index 0683d38cd2a8345ea4033cf901bb96058c9dfdd1..d409ed35383a2204fdf7617b11d28fec63520150 100644 --- a/Ganeti/HTools/Loader.hs +++ b/Ganeti/HTools/Loader.hs @@ -11,6 +11,8 @@ module Ganeti.HTools.Loader , lookupNode , lookupInstance , stripSuffix + , RqType(..) + , Request(..) ) where import Data.List @@ -23,6 +25,26 @@ import qualified Ganeti.HTools.Node as Node import Ganeti.HTools.Types +-- * Types + +{-| The request type. + +This type denotes what request we got from Ganeti and also holds +request-specific fields. + +-} +data RqType + = Allocate Instance.Instance Int -- ^ A new instance allocation + | Relocate Idx Int [Ndx] -- ^ Move an instance to a new + -- secondary node + deriving (Show) + +-- | A complete request, as received from Ganeti. +data Request = Request RqType Node.List Instance.List String + deriving (Show) + +-- * Functions + -- | Lookups a node into an assoc list. lookupNode :: (Monad m) => [(String, Ndx)] -> String -> String -> m Ndx lookupNode ktn inst node = diff --git a/Ganeti/HTools/Types.hs b/Ganeti/HTools/Types.hs index e33ab0c68d7326169398edaa5aed206261abdaa3..c1e4674649166a97142754ac4a8de42f04dc317f 100644 --- a/Ganeti/HTools/Types.hs +++ b/Ganeti/HTools/Types.hs @@ -3,7 +3,12 @@ -} module Ganeti.HTools.Types - where + ( Idx + , Ndx + , NameAssoc + , Result(..) + , Element(..) + ) where -- | The instance index type. type Idx = Int diff --git a/hail.hs b/hail.hs index 69348d12501b13134adc16015c8afc4ab1c7d8f0..a8b1c0766bfb4ea77667a3a0c96bce593afff02a 100644 --- a/hail.hs +++ b/hail.hs @@ -22,6 +22,7 @@ import qualified Ganeti.HTools.Instance as Instance import qualified Ganeti.HTools.CLI as CLI import Ganeti.HTools.IAlloc import Ganeti.HTools.Types +import Ganeti.HTools.Loader (RqType(..), Request(..)) -- | Command line options structure. data Options = Options