1082 |
1082 |
-> Instance.List -- ^ Instance list (cluster-wide)
|
1083 |
1083 |
-> EvacMode -- ^ The evacuation mode
|
1084 |
1084 |
-> [Idx] -- ^ List of instance (indices) to be evacuated
|
1085 |
|
-> Result EvacSolution
|
|
1085 |
-> Result (Node.List, Instance.List, EvacSolution)
|
1086 |
1086 |
tryNodeEvac _ ini_nl ini_il mode idxs =
|
1087 |
1087 |
let evac_ndx = nodesToEvacuate ini_il mode idxs
|
1088 |
1088 |
offline = map Node.idx . filter Node.offline $ Container.elems ini_nl
|
... | ... | |
1090 |
1090 |
group_ndx = map (\(gdx, (nl, _)) -> (gdx, map Node.idx
|
1091 |
1091 |
(Container.elems nl))) $
|
1092 |
1092 |
splitCluster ini_nl ini_il
|
1093 |
|
(_, _, esol) =
|
|
1093 |
(fin_nl, fin_il, esol) =
|
1094 |
1094 |
foldl' (\state@(nl, il, _) inst ->
|
1095 |
1095 |
updateEvacSolution state (Instance.idx inst) $
|
1096 |
1096 |
availableGroupNodes group_ndx
|
... | ... | |
1099 |
1099 |
)
|
1100 |
1100 |
(ini_nl, ini_il, emptyEvacSolution)
|
1101 |
1101 |
(map (`Container.find` ini_il) idxs)
|
1102 |
|
in return $ reverseEvacSolution esol
|
|
1102 |
in return (fin_nl, fin_il, reverseEvacSolution esol)
|
1103 |
1103 |
|
1104 |
1104 |
-- | Change-group IAllocator mode main function.
|
1105 |
1105 |
--
|
... | ... | |
1126 |
1126 |
-> [Gdx] -- ^ Target groups; if empty, any
|
1127 |
1127 |
-- groups not being evacuated
|
1128 |
1128 |
-> [Idx] -- ^ List of instance (indices) to be evacuated
|
1129 |
|
-> Result EvacSolution
|
|
1129 |
-> Result (Node.List, Instance.List, EvacSolution)
|
1130 |
1130 |
tryChangeGroup gl ini_nl ini_il gdxs idxs =
|
1131 |
1131 |
let evac_gdxs = nub $ map (instancePriGroup ini_nl .
|
1132 |
1132 |
flip Container.find ini_il) idxs
|
... | ... | |
1138 |
1138 |
group_ndx = map (\(gdx, (nl, _)) -> (gdx, map Node.idx
|
1139 |
1139 |
(Container.elems nl))) $
|
1140 |
1140 |
splitCluster ini_nl ini_il
|
1141 |
|
(_, _, esol) =
|
|
1141 |
(fin_nl, fin_il, esol) =
|
1142 |
1142 |
foldl' (\state@(nl, il, _) inst ->
|
1143 |
1143 |
let solution = do
|
1144 |
1144 |
let ncnt = Instance.requiredNodes $
|
... | ... | |
1153 |
1153 |
)
|
1154 |
1154 |
(ini_nl, ini_il, emptyEvacSolution)
|
1155 |
1155 |
(map (`Container.find` ini_il) idxs)
|
1156 |
|
in return $ reverseEvacSolution esol
|
|
1156 |
in return (fin_nl, fin_il, reverseEvacSolution esol)
|
1157 |
1157 |
|
1158 |
1158 |
-- | Recursively place instances on the cluster until we're out of space.
|
1159 |
1159 |
iterateAlloc :: Node.List
|