Revision 89363f98 src/Ganeti/HTools/Program/Hroller.hs
b/src/Ganeti/HTools/Program/Hroller.hs | ||
---|---|---|
65 | 65 |
, oNodeTags |
66 | 66 |
, oSaveCluster |
67 | 67 |
, oGroup |
68 |
, oSkipNonRedundant |
|
68 | 69 |
, oForce |
69 | 70 |
, oOneStepOnly |
70 | 71 |
] |
... | ... | |
101 | 102 |
hasTag Nothing _ = True |
102 | 103 |
hasTag (Just tags) node = not . null $ Node.nTags node `intersect` tags |
103 | 104 |
|
105 |
-- | From a cluster configuration, get the list of non-redundant instances |
|
106 |
-- of a node. |
|
107 |
nonRedundant :: (Node.List, Instance.List) -> Ndx -> [Idx] |
|
108 |
nonRedundant (nl, il) ndx = |
|
109 |
filter (not . Instance.hasSecondary . flip Container.find il) $ |
|
110 |
Node.pList (Container.find ndx nl) |
|
111 |
|
|
112 |
-- | Within a cluster configuration, decide if the node hosts non-redundant |
|
113 |
-- Instances. |
|
114 |
noNonRedundant :: (Node.List, Instance.List) -> Node.Node -> Bool |
|
115 |
noNonRedundant conf = null . nonRedundant conf . Node.idx |
|
116 |
|
|
104 | 117 |
-- | Put the master node last. |
105 | 118 |
-- Reorder a list of lists of nodes such that the master node (if present) |
106 | 119 |
-- is the last node of the last group. |
... | ... | |
141 | 154 |
|
142 | 155 |
let nodes = IntMap.filter (foldl (liftA2 (&&)) (const True) |
143 | 156 |
[ not . Node.offline |
157 |
, if optSkipNonRedundant opts |
|
158 |
then noNonRedundant (nlf, ilf) |
|
159 |
else const True |
|
144 | 160 |
, hasTag $ optNodeTags opts |
145 | 161 |
, hasGroup wantedGroup ]) |
146 | 162 |
nlf |
... | ... | |
185 | 201 |
unless (optNoHeaders opts) $ |
186 | 202 |
putStrLn "'Node Reboot Groups'" |
187 | 203 |
mapM_ (putStrLn . commaJoin) outputRebootNames |
188 |
|
Also available in: Unified diff