Revision 28b71a76 lib/server/masterd.py

b/lib/server/masterd.py
55 55
from ganeti import rpc
56 56
from ganeti import bootstrap
57 57
from ganeti import netutils
58
from ganeti import objects
58 59

  
59 60

  
60 61
CLIENT_REQUEST_WORKERS = 16
......
227 228
      return queue.WaitForJobChanges(job_id, fields, prev_job_info,
228 229
                                     prev_log_serial, timeout)
229 230

  
231
    elif method == luxi.REQ_QUERY:
232
      req = objects.QueryRequest.FromDict(args)
233

  
234
      if req.what in constants.QR_OP_QUERY:
235
        result = self._Query(opcodes.OpQuery(what=req.what, fields=req.fields,
236
                                             filter=req.filter))
237
      elif req.what in constants.QR_OP_LUXI:
238
        raise NotImplementedError
239
      else:
240
        raise errors.OpPrereqError("Resource type '%s' unknown" % req.what,
241
                                   errors.ECODE_INVAL)
242

  
243
      return result
244

  
245
    elif method == luxi.REQ_QUERY_FIELDS:
246
      req = objects.QueryFieldsRequest.FromDict(args)
247

  
248
      if req.what in constants.QR_OP_QUERY:
249
        result = self._Query(opcodes.OpQueryFields(what=req.what,
250
                                                   fields=req.fields))
251
      elif req.what in constants.QR_OP_LUXI:
252
        raise NotImplementedError
253
      else:
254
        raise errors.OpPrereqError("Resource type '%s' unknown" % req.what,
255
                                   errors.ECODE_INVAL)
256

  
257
      return result
258

  
230 259
    elif method == luxi.REQ_QUERY_JOBS:
231 260
      (job_ids, fields) = args
232 261
      if isinstance(job_ids, (tuple, list)) and job_ids:

Also available in: Unified diff