diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs index 65403b854ef42a6c2deb373d91f61a0bb9af8d07..c1f43200bc0fcf2337256ed5673ffcb8a43ece87 100644 --- a/Ganeti/HTools/Cluster.hs +++ b/Ganeti/HTools/Cluster.hs @@ -73,10 +73,7 @@ import qualified Ganeti.OpCodes as OpCodes -- * Types -- | Allocation\/relocation solution. -type AllocSolution = ([FailMode], Int, [(Score, AllocElement)]) - --- | Allocation\/relocation element. -type AllocElement = (Node.List, Instance.Instance, [Node.Node]) +type AllocSolution = ([FailMode], Int, [(Score, Node.AllocElement)]) -- | The complete state for the balancing solution data Table = Table Node.List Instance.List Score [Placement] @@ -342,7 +339,7 @@ applyMove nl inst (FailoverAndReplace new_sdx) = -- | Tries to allocate an instance on one given node. allocateOnSingle :: Node.List -> Instance.Instance -> Node.Node - -> OpResult AllocElement + -> OpResult Node.AllocElement allocateOnSingle nl inst p = let new_pdx = Node.idx p new_inst = Instance.setBoth inst new_pdx Node.noSecondary @@ -352,7 +349,7 @@ allocateOnSingle nl inst p = -- | Tries to allocate an instance on a given pair of nodes. allocateOnPair :: Node.List -> Instance.Instance -> Node.Node -> Node.Node - -> OpResult AllocElement + -> OpResult Node.AllocElement allocateOnPair nl inst tgt_p tgt_s = let new_pdx = Node.idx tgt_p new_sdx = Node.idx tgt_s @@ -492,7 +489,7 @@ collapseFailures flst = -- | Update current Allocation solution and failure stats with new -- elements -concatAllocs :: AllocSolution -> OpResult AllocElement -> AllocSolution +concatAllocs :: AllocSolution -> OpResult Node.AllocElement -> AllocSolution concatAllocs (flst, cntok, sols) (OpFail reason) = (reason:flst, cntok, sols) concatAllocs (flst, cntok, osols) (OpGood ns@(nl, _, _)) = diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index 7943c15bef64bd5693781c4953561066c4da6a35..f0006553c91aade5f072a52296af71310cb64a7b 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -56,6 +56,7 @@ module Ganeti.HTools.Node , list -- * Misc stuff , AssocList + , AllocElement , noSecondary ) where @@ -123,6 +124,10 @@ type AssocList = [(T.Ndx, Node)] -- | A simple name for a node map. type List = Container.Container Node +-- | A simple name for an allocation element (here just for logistic +-- reasons) +type AllocElement = (List, Instance.Instance, [Node]) + -- | Constant node index for a non-moveable instance. noSecondary :: T.Ndx noSecondary = -1