Revision c9a9b853
b/htools/Ganeti/HTools/Cluster.hs | ||
---|---|---|
1033 | 1033 |
then accu |
1034 | 1034 |
else new_accu |
1035 | 1035 |
|
1036 |
-- | Computes the local nodes of a given instance which are available |
|
1037 |
-- for allocation. |
|
1038 |
availableLocalNodes :: Node.List |
|
1039 |
-> [(Gdx, [Ndx])] |
|
1040 |
-> IntSet.IntSet |
|
1041 |
-> Instance.Instance |
|
1042 |
-> Result [Ndx] |
|
1043 |
availableLocalNodes nl group_nodes excl_ndx inst = do |
|
1044 |
let gdx = instancePriGroup nl inst |
|
1036 |
-- | Computes the nodes in a given group which are available for |
|
1037 |
-- allocation. |
|
1038 |
availableGroupNodes :: [(Gdx, [Ndx])] -- ^ Group index/node index assoc list |
|
1039 |
-> IntSet.IntSet -- ^ Nodes that are excluded |
|
1040 |
-> Gdx -- ^ The group for which we |
|
1041 |
-- query the nodes |
|
1042 |
-> Result [Ndx] -- ^ List of available node indices |
|
1043 |
availableGroupNodes group_nodes excl_ndx gdx = do |
|
1045 | 1044 |
local_nodes <- maybe (Bad $ "Can't find group with index " ++ show gdx) |
1046 | 1045 |
Ok (lookup gdx group_nodes) |
1047 | 1046 |
let avail_nodes = filter (not . flip IntSet.member excl_ndx) local_nodes |
... | ... | |
1076 | 1075 |
(_, _, esol) = |
1077 | 1076 |
foldl' (\state@(nl, il, _) inst -> |
1078 | 1077 |
updateEvacSolution state inst $ |
1079 |
availableLocalNodes nl group_ndx excl_ndx inst >>= |
|
1078 |
availableGroupNodes group_ndx |
|
1079 |
excl_ndx (instancePriGroup nl inst) >>= |
|
1080 | 1080 |
nodeEvacInstance nl il mode inst |
1081 | 1081 |
) |
1082 | 1082 |
(ini_nl, ini_il, emptyEvacSolution) |
Also available in: Unified diff