Revision 313fdabc src/Ganeti/HTools/Program/Hroller.hs
b/src/Ganeti/HTools/Program/Hroller.hs | ||
---|---|---|
60 | 60 |
, oVerbose |
61 | 61 |
, oQuiet |
62 | 62 |
, oNoHeaders |
63 |
, oNodeTags |
|
63 | 64 |
, oSaveCluster |
64 | 65 |
, oGroup |
65 | 66 |
, oForce |
... | ... | |
92 | 93 |
hasGroup Nothing _ = True |
93 | 94 |
hasGroup (Just grp) node = Node.group node == Group.idx grp |
94 | 95 |
|
96 |
-- | Predicate of having at least one tag in a given set. |
|
97 |
hasTag :: Maybe [String] -> Node.Node -> Bool |
|
98 |
hasTag Nothing _ = True |
|
99 |
hasTag (Just tags) node = not . null $ Node.nTags node `intersect` tags |
|
100 |
|
|
95 | 101 |
-- | Put the master node last. |
96 | 102 |
-- Reorder a list of lists of nodes such that the master node (if present) |
97 | 103 |
-- is the last node of the last group. |
... | ... | |
130 | 136 |
Nothing -> exitErr "Cannot find target group." |
131 | 137 |
Just grp -> return (Just grp) |
132 | 138 |
|
133 |
let nodes = IntMap.filter |
|
134 |
(liftA2 (&&) (not . Node.offline) (hasGroup wantedGroup)) |
|
139 |
let nodes = IntMap.filter (foldl (liftA2 (&&)) (const True) |
|
140 |
[ (not . Node.offline) |
|
141 |
, (hasTag $ optNodeTags opts) |
|
142 |
, hasGroup wantedGroup ]) |
|
135 | 143 |
nlf |
136 | 144 |
|
137 | 145 |
-- TODO: fail if instances are running (with option to warn only) |
Also available in: Unified diff