Revision 52b5d286 lib/query.py
b/lib/query.py | ||
---|---|---|
36 | 36 |
(NQ_CONFIG, |
37 | 37 |
NQ_INST, |
38 | 38 |
NQ_LIVE, |
39 |
NQ_GROUP) = range(1, 5) |
|
39 |
NQ_GROUP, |
|
40 |
NQ_OOB) = range(1, 6) |
|
40 | 41 |
|
41 | 42 |
(IQ_CONFIG, |
42 | 43 |
IQ_LIVE, |
... | ... | |
357 | 358 |
|
358 | 359 |
""" |
359 | 360 |
def __init__(self, nodes, live_data, master_name, node_to_primary, |
360 |
node_to_secondary, groups): |
|
361 |
node_to_secondary, groups, oob_support):
|
|
361 | 362 |
"""Initializes this class. |
362 | 363 |
|
363 | 364 |
""" |
... | ... | |
367 | 368 |
self.node_to_primary = node_to_primary |
368 | 369 |
self.node_to_secondary = node_to_secondary |
369 | 370 |
self.groups = groups |
371 |
self.oob_support = oob_support |
|
370 | 372 |
|
371 | 373 |
# Used for individual rows |
372 | 374 |
self.curlive_data = None |
... | ... | |
429 | 431 |
return (constants.QRFS_NORMAL, ng.name) |
430 | 432 |
|
431 | 433 |
|
434 |
def _GetNodePower(ctx, node): |
|
435 |
"""Returns the node powered state |
|
436 |
|
|
437 |
@type ctx: L{NodeQueryData} |
|
438 |
@type node: L{objects.Node} |
|
439 |
@param node: Node object |
|
440 |
|
|
441 |
""" |
|
442 |
if ctx.oob_support[node.name]: |
|
443 |
return (constants.QRFS_NORMAL, node.powered) |
|
444 |
|
|
445 |
return (constants.QRFS_UNAVAIL, None) |
|
446 |
|
|
447 |
|
|
432 | 448 |
def _GetLiveNodeField(field, kind, ctx, node): |
433 | 449 |
"""Gets the value of a "live" field from L{NodeQueryData}. |
434 | 450 |
|
... | ... | |
483 | 499 |
(_MakeField("group", "Group", constants.QFT_TEXT), NQ_GROUP, _GetNodeGroup), |
484 | 500 |
(_MakeField("group.uuid", "GroupUUID", constants.QFT_TEXT), |
485 | 501 |
NQ_CONFIG, lambda ctx, node: (constants.QRFS_NORMAL, node.group)), |
502 |
(_MakeField("powered", "Powered", constants.QFT_BOOL), NQ_OOB, |
|
503 |
_GetNodePower), |
|
486 | 504 |
] |
487 | 505 |
|
488 | 506 |
def _GetLength(getter): |
Also available in: Unified diff