Revision ee6c7b94
b/daemons/ganeti-masterd | ||
---|---|---|
227 | 227 |
(job_ids, fields) = args |
228 | 228 |
return queue.QueryJobs(job_ids, fields) |
229 | 229 |
|
230 |
elif method == luxi.REQ_QUERY_INSTANCES: |
|
231 |
(names, fields) = args |
|
232 |
op = opcodes.OpQueryInstances(names=names, output_fields=fields) |
|
233 |
return self._Query(op) |
|
234 |
|
|
230 | 235 |
else: |
231 | 236 |
raise ValueError("Invalid operation") |
232 | 237 |
|
238 |
def _DummyLog(self, *args): |
|
239 |
pass |
|
240 |
|
|
241 |
def _Query(self, op): |
|
242 |
"""Runs the specified opcode and returns the result. |
|
243 |
|
|
244 |
""" |
|
245 |
proc = mcpu.Processor(self.server.context) |
|
246 |
# TODO: Where should log messages go? |
|
247 |
return proc.ExecOpCode(op, self._DummyLog) |
|
248 |
|
|
233 | 249 |
|
234 | 250 |
class GanetiContext(object): |
235 | 251 |
"""Context common to all ganeti threads. |
b/lib/luxi.py | ||
---|---|---|
47 | 47 |
REQ_CANCEL_JOB = "CancelJob" |
48 | 48 |
REQ_ARCHIVE_JOB = "ArchiveJob" |
49 | 49 |
REQ_QUERY_JOBS = "QueryJobs" |
50 |
REQ_QUERY_INSTANCES = "QueryInstances" |
|
50 | 51 |
|
51 | 52 |
DEF_CTMO = 10 |
52 | 53 |
DEF_RWTO = 60 |
... | ... | |
288 | 289 |
def QueryJobs(self, job_ids, fields): |
289 | 290 |
return self.CallMethod(REQ_QUERY_JOBS, (job_ids, fields)) |
290 | 291 |
|
292 |
def QueryInstances(self, names, fields): |
|
293 |
return self.CallMethod(REQ_QUERY_INSTANCES, (names, fields)) |
|
294 |
|
|
291 | 295 |
# TODO: class Server(object) |
Also available in: Unified diff