On Thu, May 16, 2013 at 12:58:56PM +0200, Klaus Aehlig wrote:
> Non-redundant instances need to be moved to a different node
> before maintenance of the node. Even though they can be moved to
> any node, there must be enough capacity to host the instances of the
> reboot group to be evacuated.
>
> This is achieved by greedily moving the non-redundant instances
> to other nodes, till we run out of capacity. In this way we
> refine the groups obtained by coloring the drbd-induced graph.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
> src/Ganeti/HTools/Program/Hroller.hs | 72
> +++++++++++++++++++++++++++++++++++-
> 1 file changed, 70 insertions(+), 2 deletions(-)
Tacitly ignoring errors probably isn't a good idea; so I'd like to
include the following interdiff in this patch.
diff --git a/src/Ganeti/HTools/Program/Hroller.hs
b/src/Ganeti/HTools/Program/Hroller.hs
index 15cfcef..effda1e 100644
--- a/src/Ganeti/HTools/Program/Hroller.hs
+++ b/src/Ganeti/HTools/Program/Hroller.hs
@@ -228,11 +228,13 @@ main opts args = do
smallestColoring =
(snd . minimumBy (comparing (IntMap.size . snd))) colorings
allNdx = map Node.idx $ Container.elems nlf
- rebootGroups = IntMap.elems smallestColoring >>=
- \ grp -> case partitionNonRedundant grp allNdx (nlf,ilf)
of
- Ok grps -> grps
- Bad _ -> []
- idToNode = (`Container.find` nodes)
+ splitted = mapM (\ grp -> partitionNonRedundant grp allNdx (nlf,ilf)) $
+ IntMap.elems smallestColoring
+ rebootGroups <- case (splitted :: Result [[[Ndx]]]) of
+ Ok splitgroups -> return $ concat splitgroups
+ Bad _ -> exitErr "Not enough capacity to move
non-redundant\
+ \ instances"
+ let idToNode = (`Container.find` nodes)
nodesRebootGroups =
map (map idToNode . filter (`IntMap.member` nodes)) rebootGroups
outputRebootGroups = masterLast .