Revision 36162faf src/Ganeti/Query/Query.hs

b/src/Ganeti/Query/Query.hs
70 70
import qualified Ganeti.Query.Export as Export
71 71
import Ganeti.Query.Filter
72 72
import qualified Ganeti.Query.Job as Query.Job
73
import Ganeti.Query.Group
73
import qualified Ganeti.Query.Group as Group
74 74
import Ganeti.Query.Language
75
import Ganeti.Query.Network
76
import Ganeti.Query.Node
75
import qualified Ganeti.Query.Network as Network
76
import qualified Ganeti.Query.Node as Node
77 77
import Ganeti.Query.Types
78 78
import Ganeti.Path
79 79
import Ganeti.Types
......
168 168

  
169 169
queryInner cfg live (Query (ItemTypeOpCode QRNode) fields qfilter) wanted =
170 170
  runResultT $ do
171
  cfilter <- resultT $ compileFilter nodeFieldsMap qfilter
172
  let selected = getSelectedFields nodeFieldsMap fields
171
  cfilter <- resultT $ compileFilter Node.fieldsMap qfilter
172
  let selected = getSelectedFields Node.fieldsMap fields
173 173
      (fdefs, fgetters, _) = unzip3 selected
174 174
      live' = live && needsLiveData fgetters
175 175
  nodes <- resultT $ case wanted of
......
182 182
                      nodes
183 183
  -- here we would run the runtime data gathering, then filter again
184 184
  -- the nodes, based on existing runtime data
185
  nruntimes <- lift $ maybeCollectLiveData live' cfg fnodes
185
  nruntimes <- lift $ Node.collectLiveData live' cfg fnodes
186 186
  let fdata = map (\(node, nrt) -> map (execGetter cfg nrt node) fgetters)
187 187
              nruntimes
188 188
  return QueryResult { qresFields = fdefs, qresData = fdata }
189 189

  
190 190
queryInner cfg _ (Query (ItemTypeOpCode QRGroup) fields qfilter) wanted =
191 191
  return $ do
192
  cfilter <- compileFilter groupFieldsMap qfilter
193
  let selected = getSelectedFields groupFieldsMap fields
192
  cfilter <- compileFilter Group.fieldsMap qfilter
193
  let selected = getSelectedFields Group.fieldsMap fields
194 194
      (fdefs, fgetters, _) = unzip3 selected
195 195
  groups <- case wanted of
196 196
              [] -> Ok . niceSortKey groupName .
......
199 199
  -- there is no live data for groups, so filtering is much simpler
200 200
  fgroups <- filterM (\n -> evaluateFilter cfg Nothing n cfilter) groups
201 201
  let fdata = map (\node ->
202
                       map (execGetter cfg GroupRuntime node) fgetters) fgroups
202
                     map (execGetter cfg Group.Runtime node) fgetters) fgroups
203 203
  return QueryResult { qresFields = fdefs, qresData = fdata }
204 204

  
205 205
queryInner cfg _ (Query (ItemTypeOpCode QRNetwork) fields qfilter) wanted =
206 206
  return $ do
207
  cfilter <- compileFilter networkFieldsMap qfilter
208
  let selected = getSelectedFields networkFieldsMap fields
207
  cfilter <- compileFilter Network.fieldsMap qfilter
208
  let selected = getSelectedFields Network.fieldsMap fields
209 209
      (fdefs, fgetters, _) = unzip3 selected
210 210
  networks <- case wanted of
211 211
                [] -> Ok . niceSortKey (fromNonEmpty . networkName) .
......
213 213
                _  -> mapM (getNetwork cfg) wanted
214 214
  fnetworks <- filterM (\n -> evaluateFilter cfg Nothing n cfilter) networks
215 215
  let fdata = map (\network ->
216
                   map (execGetter cfg NetworkRuntime network) fgetters)
216
                   map (execGetter cfg Network.Runtime network) fgetters)
217 217
                   fnetworks
218 218
  return QueryResult { qresFields = fdefs, qresData = fdata }
219 219

  
......
308 308
-- | Query fields call.
309 309
queryFields :: QueryFields -> ErrorResult QueryFieldsResult
310 310
queryFields (QueryFields (ItemTypeOpCode QRNode) fields) =
311
  Ok $ fieldsExtractor nodeFieldsMap fields
311
  Ok $ fieldsExtractor Node.fieldsMap fields
312 312

  
313 313
queryFields (QueryFields (ItemTypeOpCode QRGroup) fields) =
314
  Ok $ fieldsExtractor groupFieldsMap fields
314
  Ok $ fieldsExtractor Group.fieldsMap fields
315 315

  
316 316
queryFields (QueryFields (ItemTypeLuxi QRJob) fields) =
317 317
  Ok $ fieldsExtractor Query.Job.fieldsMap fields

Also available in: Unified diff