Revision b23226d5
b/src/Ganeti/Query/Node.hs | ||
---|---|---|
36 | 36 |
import qualified Text.JSON as J |
37 | 37 |
|
38 | 38 |
import Ganeti.Config |
39 |
import Ganeti.Logging |
|
39 | 40 |
import Ganeti.Objects |
40 | 41 |
import Ganeti.JSON |
41 | 42 |
import Ganeti.Rpc |
... | ... | |
214 | 215 |
fieldsMap = |
215 | 216 |
Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) nodeFields |
216 | 217 |
|
218 |
-- | Scan the list of results produced by executeRpcCall and log all the RPC |
|
219 |
-- errors. |
|
220 |
logRpcErrors :: [(Node, Runtime)] -> IO () |
|
221 |
logRpcErrors allElems = |
|
222 |
let logOneRpcErr (_, Right _) = return () |
|
223 |
logOneRpcErr (_, Left err) = |
|
224 |
logError $ "Error in the RPC HTTP reply: " ++ show err |
|
225 |
in mapM_ logOneRpcErr allElems |
|
226 |
|
|
217 | 227 |
-- | Collect live data from RPC query if enabled. |
218 | 228 |
-- |
219 | 229 |
-- FIXME: Check which fields we actually need and possibly send empty |
... | ... | |
233 | 243 |
Nothing -> (n : bn, gn, em) |
234 | 244 |
(bnodes, gnodes, emap) = foldr step ([], [], []) nodes |
235 | 245 |
rpcres <- executeRpcCall gnodes (RpcCallNodeInfo vgs hvs (Map.fromList emap)) |
246 |
logRpcErrors rpcres |
|
236 | 247 |
-- FIXME: The order of nodes in the result could be different from the input |
237 | 248 |
return $ zip bnodes (repeat $ Left (RpcResultError "Broken configuration")) |
238 | 249 |
++ rpcres |
Also available in: Unified diff