import qualified Text.JSON as J
import Ganeti.Config
-import Ganeti.Logging
import Ganeti.Objects
import Ganeti.JSON
import Ganeti.Rpc
fieldsMap =
Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) nodeFields
--- | Scan the list of results produced by executeRpcCall and log all the RPC
--- errors.
-logRpcErrors :: [(Node, Runtime)] -> IO ()
-logRpcErrors allElems =
- let logOneRpcErr (_, Right _) = return ()
- logOneRpcErr (_, Left err) =
- logError $ "Error in the RPC HTTP reply: " ++ show err
- in mapM_ logOneRpcErr allElems
-
-- | Collect live data from RPC query if enabled.
--
-- FIXME: Check which fields we actually need and possibly send empty
Nothing -> (n : bn, gn, em)
(bnodes, gnodes, emap) = foldr step ([], [], []) nodes
rpcres <- executeRpcCall gnodes (RpcCallNodeInfo vgs hvs (Map.fromList emap))
- logRpcErrors rpcres
-- FIXME: The order of nodes in the result could be different from the input
return $ zip bnodes (repeat $ Left (RpcResultError "Broken configuration"))
++ rpcres