Revision 1ba01ff7 htools/Ganeti/Query/Query.hs

b/htools/Ganeti/Query/Query.hs
65 65
import Ganeti.Errors
66 66
import Ganeti.JQueue
67 67
import Ganeti.JSON
68
import Ganeti.Rpc
69 68
import Ganeti.Objects
70 69
import Ganeti.Query.Common
71 70
import Ganeti.Query.Filter
......
105 104
getSelectedFields defined =
106 105
  map (\name -> fromMaybe (mkUnknownFDef name) $ name `Map.lookup` defined)
107 106

  
108
-- | Collect live data from RPC query if enabled.
109
-- FIXME: Check which fields we actually need and possibly send empty
110
-- hvs/vgs if no info from hypervisor/volume group respectively
111
-- is required
112
maybeCollectLiveData:: Bool -> ConfigData -> [Node] -> IO [(Node, NodeRuntime)]
113

  
114
maybeCollectLiveData False _ nodes =
115
  return $ zip nodes (repeat $ Left (RpcResultError "Live data disabled"))
116

  
117
maybeCollectLiveData True cfg nodes = do
118
  let vgs = [clusterVolumeGroupName $ configCluster cfg]
119
      hvs = [getDefaultHypervisor cfg]
120
  executeRpcCall nodes (RpcCallNodeInfo vgs hvs)
121

  
122 107
-- | Check whether list of queried fields contains live fields.
123 108
needsLiveData :: [FieldGetter a b] -> Bool
124 109
needsLiveData = any isRuntimeField

Also available in: Unified diff