Revision 1f005f16 src/Ganeti/Confd/Server.hs
b/src/Ganeti/Confd/Server.hs | ||
---|---|---|
193 | 193 |
(a, b, c, d, e, f) <- minors] |
194 | 194 |
return (ReplyStatusOk, J.showJSON encoded) |
195 | 195 |
|
196 |
-- | Return the list of instances for a node (as ([primary], [secondary])) given |
|
197 |
-- the node name. |
|
196 | 198 |
buildResponse cdata req@(ConfdRequest { confdRqType = ReqNodeInstances }) = do |
197 | 199 |
let cfg = fst cdata |
198 | 200 |
node_name <- case confdRqQuery req of |
199 | 201 |
PlainQuery str -> return str |
200 | 202 |
_ -> fail $ "Invalid query type " ++ show (confdRqQuery req) |
201 |
let instances = getNodeInstances cfg node_name |
|
203 |
node <- |
|
204 |
case getNode cfg node_name of |
|
205 |
Ok n -> return n |
|
206 |
Bad e -> fail $ "Node not found in the configuration: " ++ show e |
|
207 |
let node_uuid = nodeUuid node |
|
208 |
instances = getNodeInstances cfg node_uuid |
|
202 | 209 |
return (ReplyStatusOk, J.showJSON instances) |
203 | 210 |
|
204 | 211 |
-- | Creates a ConfdReply from a given answer. |
Also available in: Unified diff