Revision 39f979b8 Ganeti/HTools/Loader.hs
b/Ganeti/HTools/Loader.hs | ||
---|---|---|
129 | 129 |
old_tags |
130 | 130 |
in inst { Instance.tags = new_tags } |
131 | 131 |
|
132 |
-- | Update the movable attribute |
|
133 |
updateMovable :: [String] -> Instance.Instance -> Instance.Instance |
|
134 |
updateMovable exinst inst = |
|
135 |
if Instance.sNode inst == Node.noSecondary || |
|
136 |
Instance.name inst `elem` exinst |
|
137 |
then Instance.setMovable inst False |
|
138 |
else inst |
|
139 |
|
|
132 | 140 |
-- | Compute the longest common suffix of a list of strings that |
133 | 141 |
-- | starts with a dot. |
134 | 142 |
longestDomain :: [String] -> String |
... | ... | |
153 | 161 |
-- list and massages it into the correct format. |
154 | 162 |
mergeData :: [(String, DynUtil)] -- ^ Instance utilisation data |
155 | 163 |
-> [String] -- ^ Exclusion tags |
164 |
-> [String] -- ^ Untouchable instances |
|
156 | 165 |
-> (Node.AssocList, Instance.AssocList, [String]) |
157 | 166 |
-- ^ Data from backends |
158 | 167 |
-> Result (Node.List, Instance.List, [String], String) |
159 |
mergeData um extags (nl, il, tags) = |
|
168 |
mergeData um extags exinsts (nl, il, tags) =
|
|
160 | 169 |
let il2 = Container.fromAssocList il |
161 | 170 |
il3 = foldl' (\im (name, n_util) -> |
162 | 171 |
case Container.findByName im name of |
... | ... | |
166 | 175 |
in Container.add (Instance.idx inst) new_i im |
167 | 176 |
) il2 um |
168 | 177 |
allextags = extags ++ extractExTags tags |
169 |
il4 = Container.map (filterExTags allextags) il3 |
|
178 |
il4 = Container.map (filterExTags allextags . |
|
179 |
updateMovable exinsts) il3 |
|
170 | 180 |
nl2 = foldl' fixNodes nl (Container.elems il4) |
171 | 181 |
nl3 = Container.fromAssocList |
172 | 182 |
(map (\ (k, v) -> (k, Node.buildPeers v il4)) nl2) |
Also available in: Unified diff