Revision a0d64991
b/lib/cmdlib.py | ||
---|---|---|
3814 | 3814 |
live_data) |
3815 | 3815 |
|
3816 | 3816 |
|
3817 |
#: Query type implementations |
|
3818 |
_QUERY_IMPL = { |
|
3819 |
constants.QR_INSTANCE: _InstanceQuery, |
|
3820 |
constants.QR_NODE: _NodeQuery, |
|
3821 |
} |
|
3822 |
|
|
3823 |
|
|
3824 |
def _GetQueryImplementation(name): |
|
3825 |
"""Returns the implemtnation for a query type. |
|
3826 |
|
|
3827 |
@param name: Query type, must be one of L{constants.QR_OP_QUERY} |
|
3828 |
|
|
3829 |
""" |
|
3830 |
try: |
|
3831 |
return _QUERY_IMPL[name] |
|
3832 |
except KeyError: |
|
3833 |
raise errors.OpPrereqError("Unknown query resource '%s'" % name, |
|
3834 |
errors.ECODE_INVAL) |
|
3835 |
|
|
3836 |
|
|
3837 | 3817 |
class LUQuery(NoHooksLU): |
3838 | 3818 |
"""Query for resources/items of a certain kind. |
3839 | 3819 |
|
... | ... | |
11030 | 11010 |
ial.Run(self.op.allocator, validate=False) |
11031 | 11011 |
result = ial.out_text |
11032 | 11012 |
return result |
11013 |
|
|
11014 |
|
|
11015 |
#: Query type implementations |
|
11016 |
_QUERY_IMPL = { |
|
11017 |
constants.QR_INSTANCE: _InstanceQuery, |
|
11018 |
constants.QR_NODE: _NodeQuery, |
|
11019 |
} |
|
11020 |
|
|
11021 |
|
|
11022 |
def _GetQueryImplementation(name): |
|
11023 |
"""Returns the implemtnation for a query type. |
|
11024 |
|
|
11025 |
@param name: Query type, must be one of L{constants.QR_OP_QUERY} |
|
11026 |
|
|
11027 |
""" |
|
11028 |
try: |
|
11029 |
return _QUERY_IMPL[name] |
|
11030 |
except KeyError: |
|
11031 |
raise errors.OpPrereqError("Unknown query resource '%s'" % name, |
|
11032 |
errors.ECODE_INVAL) |
Also available in: Unified diff