Revision fdbdeaa3
b/src/Ganeti/HTools/Program/Hroller.hs | ||
---|---|---|
141 | 141 |
-> Result ([Ndx], (Node.List, Instance.List)) |
142 | 142 |
clearNodes = greedyClearNodes nonRedundant locateInstances |
143 | 143 |
|
144 |
-- | Parition a list of nodes into chunks according cluster capacity. |
|
145 |
partitionNonRedundant :: [Ndx] -> [Ndx] -> (Node.List, Instance.List) |
|
146 |
-> Result [([Ndx], (Node.List, Instance.List))] |
|
147 |
partitionNonRedundant [] _ _ = return [] |
|
148 |
partitionNonRedundant ndxs targets conf = do |
|
149 |
(grp, conf') <- clearNodes ndxs targets conf |
|
144 |
-- | Partition nodes according to some clearing strategy. |
|
145 |
-- Arguments are the clearing strategy, the list of nodes to be cleared, |
|
146 |
-- the list of nodes that instances can be moved to, and the initial |
|
147 |
-- configuration. Returned is a partion of the nodes to be cleared with the |
|
148 |
-- configuration in that clearing situation. |
|
149 |
partitionNodes :: ([Ndx] -> [Ndx] -> (Node.List, Instance.List) |
|
150 |
-> Result ([Ndx], (Node.List, Instance.List))) |
|
151 |
-> [Ndx] -> [Ndx] -> (Node.List, Instance.List) |
|
152 |
-> Result [([Ndx], (Node.List, Instance.List))] |
|
153 |
partitionNodes _ [] _ _ = return [] |
|
154 |
partitionNodes clear ndxs targets conf = do |
|
155 |
(grp, conf') <- clear ndxs targets conf |
|
150 | 156 |
guard . not . null $ grp |
151 | 157 |
let remaining = ndxs \\ grp |
152 |
part <- partitionNonRedundant remaining targets conf
|
|
158 |
part <- partitionNodes clear remaining targets conf
|
|
153 | 159 |
return $ (grp, conf') : part |
154 | 160 |
|
161 |
-- | Parition a list of nodes into chunks according cluster capacity. |
|
162 |
partitionNonRedundant :: [Ndx] -> [Ndx] -> (Node.List, Instance.List) |
|
163 |
-> Result [([Ndx], (Node.List, Instance.List))] |
|
164 |
partitionNonRedundant = partitionNodes clearNodes |
|
165 |
|
|
155 | 166 |
-- | Gather statistics for the coloring algorithms. |
156 | 167 |
-- Returns a string with a summary on how each algorithm has performed, |
157 | 168 |
-- in order of non-decreasing effectiveness, and whether it tied or lost |
Also available in: Unified diff