Revision 2a8e2dc9 htools/Ganeti/HTools/Cluster.hs
b/htools/Ganeti/HTools/Cluster.hs | ||
---|---|---|
515 | 515 |
tables = parMap rwhnf (checkInstanceMove nodes_idx disk_moves ini_tbl) |
516 | 516 |
victims |
517 | 517 |
-- iterate over all instances, computing the best move |
518 |
best_tbl = |
|
519 |
foldl' |
|
520 |
(\ step_tbl new_tbl -> compareTables step_tbl new_tbl) |
|
521 |
ini_tbl tables |
|
518 |
best_tbl = foldl' compareTables ini_tbl tables |
|
522 | 519 |
Table _ _ _ best_plc = best_tbl |
523 | 520 |
in if length best_plc == length ini_plc |
524 | 521 |
then ini_tbl -- no advancement |
... | ... | |
694 | 691 |
-> [(Gdx, AllocSolution)] |
695 | 692 |
-> [(Gdx, AllocSolution)] |
696 | 693 |
sortMGResults gl sols = |
697 |
let extractScore = \(_, _, _, x) -> x
|
|
694 |
let extractScore (_, _, _, x) = x
|
|
698 | 695 |
solScore (gdx, sol) = (Group.allocPolicy (Container.find gdx gl), |
699 | 696 |
(extractScore . head . asSolutions) sol) |
700 | 697 |
in sortBy (comparing solScore) sols |
... | ... | |
837 | 834 |
all_insts3 |
838 | 835 |
results <- mapM (\(_, gnl, gil, idxs) -> tryEvac gnl gil idxs ex_ndx) |
839 | 836 |
all_insts4 |
840 |
let sol = foldl' (\orig_sol group_sol -> |
|
841 |
sumAllocs orig_sol group_sol) emptySolution results |
|
837 |
let sol = foldl' sumAllocs emptySolution results |
|
842 | 838 |
return $ annotateSolution sol |
843 | 839 |
|
844 | 840 |
-- | Recursively place instances on the cluster until we're out of space |
... | ... | |
1084 | 1080 |
-- | Compute the list of badly allocated instances (split across node |
1085 | 1081 |
-- groups) |
1086 | 1082 |
findSplitInstances :: Node.List -> Instance.List -> [Instance.Instance] |
1087 |
findSplitInstances nl il =
|
|
1088 |
filter (not . isOk . instanceGroup nl) (Container.elems il)
|
|
1083 |
findSplitInstances nl = |
|
1084 |
filter (not . isOk . instanceGroup nl) . Container.elems
|
|
1089 | 1085 |
|
1090 | 1086 |
-- | Splits a cluster into the component node groups |
1091 | 1087 |
splitCluster :: Node.List -> Instance.List -> |
Also available in: Unified diff