Revision 2f907bad htools/Ganeti/HTools/Loader.hs
b/htools/Ganeti/HTools/Loader.hs | ||
---|---|---|
151 | 151 |
gpol = Group.iPolicy grp |
152 | 152 |
in Node.setPolicy gpol node |
153 | 153 |
|
154 |
-- | Remove non-selected tags from the exclusion list.
|
|
155 |
filterExTags :: [String] -> Instance.Instance -> Instance.Instance
|
|
156 |
filterExTags tl inst =
|
|
157 |
let old_tags = Instance.tags inst
|
|
158 |
new_tags = filter (\tag -> any (`isPrefixOf` tag) tl) old_tags
|
|
159 |
in inst { Instance.tags = new_tags }
|
|
154 |
-- | Update instance with exclusion tags list.
|
|
155 |
updateExclTags :: [String] -> Instance.Instance -> Instance.Instance
|
|
156 |
updateExclTags tl inst =
|
|
157 |
let allTags = Instance.allTags inst
|
|
158 |
exclTags = filter (\tag -> any (`isPrefixOf` tag) tl) allTags
|
|
159 |
in inst { Instance.exclTags = exclTags }
|
|
160 | 160 |
|
161 | 161 |
-- | Update the movable attribute. |
162 | 162 |
updateMovable :: [String] -- ^ Selected instances (if not empty) |
... | ... | |
226 | 226 |
node_names = map Node.name (Container.elems nl) |
227 | 227 |
common_suffix = longestDomain (node_names ++ inst_names) |
228 | 228 |
il4 = Container.map (computeAlias common_suffix . |
229 |
filterExTags allextags .
|
|
229 |
updateExclTags allextags .
|
|
230 | 230 |
updateMovable selinst_names exinst_names) il3 |
231 | 231 |
nl2 = foldl' fixNodes nl (Container.elems il4) |
232 | 232 |
nl3 = Container.map (setNodePolicy gl . |
Also available in: Unified diff