Revision 23247a73
b/src/Ganeti/HTools/CLI.hs | ||
---|---|---|
55 | 55 |
, oForce |
56 | 56 |
, oGroup |
57 | 57 |
, oIAllocSrc |
58 |
, oIgnoreNonRedundant |
|
58 | 59 |
, oInstMoves |
59 | 60 |
, oJobDelay |
60 | 61 |
, genOLuxiSocket |
... | ... | |
125 | 126 |
, optForce :: Bool -- ^ Force the execution |
126 | 127 |
, optGroup :: Maybe GroupID -- ^ The UUID of the group to process |
127 | 128 |
, optIAllocSrc :: Maybe FilePath -- ^ The iallocation spec |
129 |
, optIgnoreNonRedundant :: Bool -- ^ Ignore non-redundant instances |
|
128 | 130 |
, optSelInst :: [String] -- ^ Instances to be excluded |
129 | 131 |
, optLuxi :: Maybe FilePath -- ^ Collect data from Luxi |
130 | 132 |
, optJobDelay :: Double -- ^ Delay before executing first job |
... | ... | |
176 | 178 |
, optForce = False |
177 | 179 |
, optGroup = Nothing |
178 | 180 |
, optIAllocSrc = Nothing |
181 |
, optIgnoreNonRedundant = False |
|
179 | 182 |
, optSelInst = [] |
180 | 183 |
, optLuxi = Nothing |
181 | 184 |
, optJobDelay = 10 |
... | ... | |
356 | 359 |
"Specify an iallocator spec as the cluster data source", |
357 | 360 |
OptComplFile) |
358 | 361 |
|
362 |
oIgnoreNonRedundant :: OptType |
|
363 |
oIgnoreNonRedundant = |
|
364 |
(Option "" ["ignore-non-redundant"] |
|
365 |
(NoArg (\ opts -> Ok opts { optIgnoreNonRedundant = True })) |
|
366 |
"Pretend that there are no non-redundant instances in the cluster", |
|
367 |
OptComplNone) |
|
368 |
|
|
359 | 369 |
oJobDelay :: OptType |
360 | 370 |
oJobDelay = |
361 | 371 |
(Option "" ["job-delay"] |
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