Revision e566ddbd daemons/ganeti-masterd
b/daemons/ganeti-masterd | ||
---|---|---|
209 | 209 |
# TODO: Parameter validation |
210 | 210 |
|
211 | 211 |
if method == luxi.REQ_SUBMIT_JOB: |
212 |
logging.info("Received new job") |
|
212 | 213 |
ops = [opcodes.OpCode.LoadOpCode(state) for state in args] |
213 | 214 |
return queue.SubmitJob(ops) |
214 | 215 |
|
215 | 216 |
elif method == luxi.REQ_CANCEL_JOB: |
216 | 217 |
job_id = args |
218 |
logging.info("Received job cancel request for %s", job_id) |
|
217 | 219 |
return queue.CancelJob(job_id) |
218 | 220 |
|
219 | 221 |
elif method == luxi.REQ_ARCHIVE_JOB: |
220 | 222 |
job_id = args |
223 |
logging.info("Received job archive request for %s", job_id) |
|
221 | 224 |
return queue.ArchiveJob(job_id) |
222 | 225 |
|
223 | 226 |
elif method == luxi.REQ_AUTOARCHIVE_JOBS: |
224 | 227 |
(age, timeout) = args |
228 |
logging.info("Received job autoarchive request for age %s, timeout %s", |
|
229 |
age, timeout) |
|
225 | 230 |
return queue.AutoArchiveJobs(age, timeout) |
226 | 231 |
|
227 | 232 |
elif method == luxi.REQ_WAIT_FOR_JOB_CHANGE: |
228 | 233 |
(job_id, fields, prev_job_info, prev_log_serial, timeout) = args |
234 |
logging.info("Received job poll request for %s", job_id) |
|
229 | 235 |
return queue.WaitForJobChanges(job_id, fields, prev_job_info, |
230 | 236 |
prev_log_serial, timeout) |
231 | 237 |
|
232 | 238 |
elif method == luxi.REQ_QUERY_JOBS: |
233 | 239 |
(job_ids, fields) = args |
240 |
if isinstance(job_ids, (tuple, list)) and job_ids: |
|
241 |
msg = ", ".join(job_ids) |
|
242 |
else: |
|
243 |
msg = str(job_ids) |
|
244 |
logging.info("Received job query request for %s", msg) |
|
234 | 245 |
return queue.QueryJobs(job_ids, fields) |
235 | 246 |
|
236 | 247 |
elif method == luxi.REQ_QUERY_INSTANCES: |
237 | 248 |
(names, fields, use_locking) = args |
249 |
logging.info("Received instance query request for %s", names) |
|
238 | 250 |
op = opcodes.OpQueryInstances(names=names, output_fields=fields, |
239 | 251 |
use_locking=use_locking) |
240 | 252 |
return self._Query(op) |
241 | 253 |
|
242 | 254 |
elif method == luxi.REQ_QUERY_NODES: |
243 | 255 |
(names, fields, use_locking) = args |
256 |
logging.info("Received node query request for %s", names) |
|
244 | 257 |
op = opcodes.OpQueryNodes(names=names, output_fields=fields, |
245 | 258 |
use_locking=use_locking) |
246 | 259 |
return self._Query(op) |
247 | 260 |
|
248 | 261 |
elif method == luxi.REQ_QUERY_EXPORTS: |
249 | 262 |
nodes, use_locking = args |
263 |
logging.info("Received exports query request") |
|
250 | 264 |
op = opcodes.OpQueryExports(nodes=nodes, use_locking=use_locking) |
251 | 265 |
return self._Query(op) |
252 | 266 |
|
253 | 267 |
elif method == luxi.REQ_QUERY_CONFIG_VALUES: |
254 | 268 |
fields = args |
269 |
logging.info("Received config values query request for %s", fields) |
|
255 | 270 |
op = opcodes.OpQueryConfigValues(output_fields=fields) |
256 | 271 |
return self._Query(op) |
257 | 272 |
|
258 | 273 |
elif method == luxi.REQ_QUERY_CLUSTER_INFO: |
274 |
logging.info("Received cluster info query request") |
|
259 | 275 |
op = opcodes.OpQueryClusterInfo() |
260 | 276 |
return self._Query(op) |
261 | 277 |
|
262 | 278 |
elif method == luxi.REQ_QUEUE_SET_DRAIN_FLAG: |
263 | 279 |
drain_flag = args |
280 |
logging.info("Received queue drain flag change request to %s", |
|
281 |
drain_flag) |
|
264 | 282 |
return queue.SetDrainFlag(drain_flag) |
265 | 283 |
|
266 | 284 |
else: |
267 |
raise ValueError("Invalid operation") |
|
285 |
logging.info("Received invalid request '%s'", method) |
|
286 |
raise ValueError("Invalid operation '%s'" % method) |
|
268 | 287 |
|
269 | 288 |
def _DummyLog(self, *args): |
270 | 289 |
pass |
Also available in: Unified diff