Revision 2a8e2dc9
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 -> |
b/htools/Ganeti/HTools/Loader.hs | ||
---|---|---|
7 | 7 |
|
8 | 8 |
{- |
9 | 9 |
|
10 |
Copyright (C) 2009, 2010 Google Inc. |
|
10 |
Copyright (C) 2009, 2010, 2011 Google Inc.
|
|
11 | 11 |
|
12 | 12 |
This program is free software; you can redistribute it and/or modify |
13 | 13 |
it under the terms of the GNU General Public License as published by |
... | ... | |
198 | 198 |
il4 = Container.map (filterExTags allextags . |
199 | 199 |
updateMovable exinsts) il3 |
200 | 200 |
nl2 = foldl' fixNodes nl (Container.elems il4) |
201 |
nl3 = Container.map (\node -> Node.buildPeers node il4) nl2
|
|
201 |
nl3 = Container.map (flip Node.buildPeers il4) nl2
|
|
202 | 202 |
node_names = map Node.name (Container.elems nl) |
203 | 203 |
inst_names = map Instance.name il |
204 | 204 |
common_suffix = longestDomain (node_names ++ inst_names) |
b/htools/Ganeti/HTools/Luxi.hs | ||
---|---|---|
213 | 213 |
-- | Top level function for data loading |
214 | 214 |
loadData :: String -- ^ Unix socket to use as source |
215 | 215 |
-> IO (Result ClusterData) |
216 |
loadData master = readData master >>= return . parseData |
|
216 |
loadData = fmap parseData . readData |
b/htools/Ganeti/HTools/Rapi.hs | ||
---|---|---|
182 | 182 |
-- | Top level function for data loading |
183 | 183 |
loadData :: String -- ^ Cluster or URL to use as source |
184 | 184 |
-> IO (Result ClusterData) |
185 |
loadData master = readData master >>= return . parseData |
|
185 |
loadData = fmap parseData . readData |
b/htools/Ganeti/HTools/Text.hs | ||
---|---|---|
188 | 188 |
-- | Top level function for data loading |
189 | 189 |
loadData :: String -- ^ Path to the text file |
190 | 190 |
-> IO (Result ClusterData) |
191 |
loadData afile = readData afile >>= return . parseData |
|
191 |
loadData = fmap parseData . readData |
Also available in: Unified diff