Revision 3603605a htools/Ganeti/HTools/Cluster.hs
b/htools/Ganeti/HTools/Cluster.hs | ||
---|---|---|
373 | 373 |
let (old_pdx, old_sdx, old_p, old_s) = instanceNodes nl inst |
374 | 374 |
int_p = Node.removePri old_p inst |
375 | 375 |
int_s = Node.removeSec old_s inst |
376 |
force_p = Node.offline old_p |
|
377 | 376 |
new_nl = do -- Maybe monad |
378 |
new_p <- Node.addPriEx force_p int_s inst
|
|
377 |
new_p <- Node.addPriEx (Node.offline old_p) int_s inst
|
|
379 | 378 |
new_s <- Node.addSec int_p inst old_sdx |
380 | 379 |
let new_inst = Instance.setBoth inst old_sdx old_pdx |
381 | 380 |
return (Container.addTwo old_pdx new_s old_sdx new_p nl, |
... | ... | |
526 | 525 |
checkInstanceMove nodes_idx disk_moves inst_moves ini_tbl target = |
527 | 526 |
let opdx = Instance.pNode target |
528 | 527 |
osdx = Instance.sNode target |
529 |
nodes = filter (\idx -> idx /= opdx && idx /= osdx) nodes_idx |
|
528 |
bad_nodes = [opdx, osdx] |
|
529 |
nodes = filter (`notElem` bad_nodes) nodes_idx |
|
530 | 530 |
use_secondary = elem osdx nodes_idx && inst_moves |
531 | 531 |
aft_failover = if use_secondary -- if allowed to failover |
532 | 532 |
then checkSingleStep ini_tbl target ini_tbl Failover |
... | ... | |
1308 | 1308 |
_ -> fs |
1309 | 1309 |
snl = sortBy (comparing Node.idx) (Container.elems nl) |
1310 | 1310 |
(header, isnum) = unzip $ map Node.showHeader fields |
1311 |
in unlines . map ((:) ' ' . intercalate " ") $
|
|
1311 |
in unlines . map ((:) ' ' . unwords) $
|
|
1312 | 1312 |
formatTable (header:map (Node.list fields) snl) isnum |
1313 | 1313 |
|
1314 | 1314 |
-- | Print the instance list. |
... | ... | |
1335 | 1335 |
header = [ "F", "Name", "Pri_node", "Sec_node", "Auto_bal" |
1336 | 1336 |
, "vcpu", "mem" , "dsk", "lCpu", "lMem", "lDsk", "lNet" ] |
1337 | 1337 |
isnum = False:False:False:False:False:repeat True |
1338 |
in unlines . map ((:) ' ' . intercalate " ") $
|
|
1338 |
in unlines . map ((:) ' ' . unwords) $
|
|
1339 | 1339 |
formatTable (header:map helper sil) isnum |
1340 | 1340 |
|
1341 | 1341 |
-- | Shows statistics for a given node list. |
Also available in: Unified diff