Revision 5296ee23 htools/Ganeti/HTools/Program/Hbal.hs
b/htools/Ganeti/HTools/Program/Hbal.hs | ||
---|---|---|
255 | 255 |
[(hangleSigTerm, softwareTermination), (hangleSigInt, keyboardSignal)] |
256 | 256 |
execWrapper master fin_nl il cref cmd_jobs |
257 | 257 |
|
258 |
-- | Set node properties based on command line options. |
|
259 |
setNodesStatus :: Options -> Node.List -> IO Node.List |
|
260 |
setNodesStatus opts fixed_nl = do |
|
261 |
let offline_passed = optOffline opts |
|
262 |
all_nodes = Container.elems fixed_nl |
|
263 |
offline_lkp = map (lookupName (map Node.name all_nodes)) offline_passed |
|
264 |
offline_wrong = filter (not . goodLookupResult) offline_lkp |
|
265 |
offline_names = map lrContent offline_lkp |
|
266 |
offline_indices = map Node.idx $ |
|
267 |
filter (\n -> Node.name n `elem` offline_names) |
|
268 |
all_nodes |
|
269 |
m_cpu = optMcpu opts |
|
270 |
m_dsk = optMdsk opts |
|
271 |
|
|
272 |
when (not (null offline_wrong)) $ do |
|
273 |
hPrintf stderr "Error: Wrong node name(s) set as offline: %s\n" |
|
274 |
(commaJoin (map lrContent offline_wrong)) :: IO () |
|
275 |
exitWith $ ExitFailure 1 |
|
276 |
|
|
277 |
let nm = Container.map (\n -> if Node.idx n `elem` offline_indices |
|
278 |
then Node.setOffline n True |
|
279 |
else n) fixed_nl |
|
280 |
nlf = Container.map (flip Node.setMdsk m_dsk . flip Node.setMcpu m_cpu) |
|
281 |
nm |
|
282 |
return nlf |
|
283 |
|
|
284 | 258 |
-- | Select the target node group. |
285 | 259 |
selectGroup :: Options -> Group.List -> Node.List -> Instance.List |
286 | 260 |
-> IO (String, (Node.List, Instance.List)) |
... | ... | |
385 | 359 |
when (verbose > 1) $ |
386 | 360 |
putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags |
387 | 361 |
|
388 |
nlf <- setNodesStatus opts fixed_nl
|
|
362 |
nlf <- setNodeStatus opts fixed_nl |
|
389 | 363 |
checkCluster verbose nlf ilf |
390 | 364 |
|
391 | 365 |
maybeSaveData (optSaveCluster opts) "original" "before balancing" ini_cdata |
Also available in: Unified diff