Revision 19f38ee8

b/Ganeti/HTools/IAlloc.hs
3 3
-}
4 4

  
5 5
module Ganeti.HTools.IAlloc
6
    (
7
      parseData
6
    ( parseData
8 7
    , formatResponse
9
    , RqType(..)
10
    , Request(..)
11 8
    ) where
12 9

  
13 10
import Data.Either ()
......
22 19
import Ganeti.HTools.Utils
23 20
import Ganeti.HTools.Types
24 21

  
25
-- | The request type.
26
data RqType
27
    = Allocate Instance.Instance Int -- ^ A new instance allocation
28
    | Relocate Idx Int [Ndx]         -- ^ Move an instance to a new
29
                                     -- secondary node
30
    deriving (Show)
31

  
32
-- | A complete request, as received from Ganeti.
33
data Request = Request RqType Node.List Instance.List String
34
    deriving (Show)
35

  
36 22
-- | Parse the basic specifications of an instance.
37 23
--
38 24
-- Instances in the cluster instance list and the instance in an
b/Ganeti/HTools/Loader.hs
11 11
    , lookupNode
12 12
    , lookupInstance
13 13
    , stripSuffix
14
    , RqType(..)
15
    , Request(..)
14 16
    ) where
15 17

  
16 18
import Data.List
......
23 25

  
24 26
import Ganeti.HTools.Types
25 27

  
28
-- * Types
29

  
30
{-| The request type.
31

  
32
This type denotes what request we got from Ganeti and also holds
33
request-specific fields.
34

  
35
-}
36
data RqType
37
    = Allocate Instance.Instance Int -- ^ A new instance allocation
38
    | Relocate Idx Int [Ndx]         -- ^ Move an instance to a new
39
                                     -- secondary node
40
    deriving (Show)
41

  
42
-- | A complete request, as received from Ganeti.
43
data Request = Request RqType Node.List Instance.List String
44
    deriving (Show)
45

  
46
-- * Functions
47

  
26 48
-- | Lookups a node into an assoc list.
27 49
lookupNode :: (Monad m) => [(String, Ndx)] -> String -> String -> m Ndx
28 50
lookupNode ktn inst node =
b/Ganeti/HTools/Types.hs
3 3
-}
4 4

  
5 5
module Ganeti.HTools.Types
6
    where
6
    ( Idx
7
    , Ndx
8
    , NameAssoc
9
    , Result(..)
10
    , Element(..)
11
    ) where
7 12

  
8 13
-- | The instance index type.
9 14
type Idx = Int
b/hail.hs
22 22
import qualified Ganeti.HTools.CLI as CLI
23 23
import Ganeti.HTools.IAlloc
24 24
import Ganeti.HTools.Types
25
import Ganeti.HTools.Loader (RqType(..), Request(..))
25 26

  
26 27
-- | Command line options structure.
27 28
data Options = Options

Also available in: Unified diff