Revision 23247a73 src/Ganeti/HTools/Program/Hroller.hs

b/src/Ganeti/HTools/Program/Hroller.hs
69 69
    , oSaveCluster
70 70
    , oGroup
71 71
    , oSkipNonRedundant
72
    , oIgnoreNonRedundant
72 73
    , oForce
73 74
    , oOneStepOnly
74 75
    ]
......
234 235
                        , ("Dcolor", colorDcolor)
235 236
                        ]
236 237
      colorings = map (\(v,a) -> (v,(colorVertMap.a) nodeGraph)) colorAlgorithms
237
      smallestColoring =
238
      smallestColoring = IntMap.elems $
238 239
        (snd . minimumBy (comparing (IntMap.size . snd))) colorings
239 240
      allNdx = map Node.idx $ Container.elems nlf
240
      splitted = mapM (\ grp -> partitionNonRedundant grp allNdx (nlf,ilf)) $
241
                 IntMap.elems smallestColoring
242
  rebootGroups <- case splitted of
243
                    Ok splitgroups -> return $ concat splitgroups
244
                    Bad _ -> exitErr "Not enough capacity to move non-redundant\ 
245
                                     \ instances"
241
      splitted = mapM (\ grp -> partitionNonRedundant grp allNdx (nlf,ilf))
242
                 smallestColoring
243
  rebootGroups <- if optIgnoreNonRedundant opts
244
                     then return smallestColoring
245
                     else case splitted of
246
                            Ok splitgroups -> return $ concat splitgroups
247
                            Bad _ -> exitErr "Not enough capacity to move\ 
248
                                             \ non-redundant instances"
246 249
  let idToNode = (`Container.find` nodes)
247 250
      nodesRebootGroups =
248 251
        map (map idToNode . filter (`IntMap.member` nodes)) rebootGroups

Also available in: Unified diff