Revision 92e32d76 Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
32 32
      Placement
33 33
    , AllocSolution
34 34
    , Table(..)
35
    , Score
36
    , IMove(..)
37 35
    , CStats(..)
38 36
    -- * Generic functions
39 37
    , totalResources
......
72 70

  
73 71
-- * Types
74 72

  
75
-- | A separate name for the cluster score type.
76
type Score = Double
77

  
78
-- | The description of an instance placement.
79
type Placement = ( Idx   -- ^ The index of the instance being moved
80
                 , Ndx   -- ^ New primary node
81
                 , Ndx   -- ^ New secondary node
82
                 , IMove -- ^ The move being performed
83
                 , Score -- ^ The score of the cluster after this move
84
                 )
85

  
86 73
-- | Allocation\/relocation solution.
87 74
type AllocSolution = ([FailMode], Int, Maybe (Score, AllocElement))
88 75

  
89 76
-- | Allocation\/relocation element.
90 77
type AllocElement = (Node.List, Instance.Instance, [Node.Node])
91 78

  
92
-- | An instance move definition
93
data IMove = Failover                -- ^ Failover the instance (f)
94
           | ReplacePrimary Ndx      -- ^ Replace primary (f, r:np, f)
95
           | ReplaceSecondary Ndx    -- ^ Replace secondary (r:ns)
96
           | ReplaceAndFailover Ndx  -- ^ Replace secondary, failover (r:np, f)
97
           | FailoverAndReplace Ndx  -- ^ Failover, replace secondary (f, r:ns)
98
             deriving (Show)
99 79

  
100 80
-- | The complete state for the balancing solution
101 81
data Table = Table Node.List Instance.List Score [Placement]

Also available in: Unified diff