Revision d8e55568
b/doc/rapi.rst | ||
---|---|---|
2112 | 2112 |
FIXME: enable ".. pyassert::" again when all storage types are |
2113 | 2113 |
implemented:: |
2114 | 2114 |
|
2115 |
constants.VALID_STORAGE_TYPES == set([constants.ST_FILE,
|
|
2116 |
constants.ST_LVM_PV,
|
|
2117 |
constants.ST_LVM_VG])
|
|
2115 |
constants.STORAGE_TYPES == set([constants.ST_FILE, |
|
2116 |
constants.ST_LVM_PV, |
|
2117 |
constants.ST_LVM_VG]) |
|
2118 | 2118 |
|
2119 | 2119 |
Requests a list of storage units on a node. Requires the parameters |
2120 | 2120 |
``storage_type`` (one of :pyeval:`constants.ST_FILE`, |
b/lib/cmdlib/common.py | ||
---|---|---|
1101 | 1101 |
|
1102 | 1102 |
""" |
1103 | 1103 |
assert storage_type is not None |
1104 |
assert storage_type in constants.VALID_STORAGE_TYPES
|
|
1104 |
assert storage_type in constants.STORAGE_TYPES |
|
1105 | 1105 |
# special case for lvm-pv, because it cannot be enabled |
1106 | 1106 |
# via disk templates |
1107 | 1107 |
if storage_type == constants.ST_LVM_PV: |
b/lib/constants.py | ||
---|---|---|
384 | 384 |
ST_LVM_VG = "lvm-vg" |
385 | 385 |
ST_RADOS = "rados" |
386 | 386 |
|
387 |
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
|
|
387 |
STORAGE_TYPES = compat.UniqueFrozenset([ |
|
388 | 388 |
ST_BLOCK, |
389 | 389 |
ST_DISKLESS, |
390 | 390 |
ST_EXT, |
b/lib/opcodes.py | ||
---|---|---|
360 | 360 |
"""Ensure a given storage type is valid. |
361 | 361 |
|
362 | 362 |
""" |
363 |
if storage_type not in constants.VALID_STORAGE_TYPES:
|
|
363 |
if storage_type not in constants.STORAGE_TYPES: |
|
364 | 364 |
raise errors.OpPrereqError("Unknown storage type: %s" % storage_type, |
365 | 365 |
errors.ECODE_INVAL) |
366 | 366 |
return True |
b/lib/utils/storage.py | ||
---|---|---|
130 | 130 |
@rtype: list of tuples (string, string) |
131 | 131 |
@return: list of storage units, each storage unit being a tuple of |
132 | 132 |
(storage_type, storage_key); storage_type is in |
133 |
C{constants.VALID_STORAGE_TYPES} and the storage_key a string to
|
|
133 |
C{constants.STORAGE_TYPES} and the storage_key a string to |
|
134 | 134 |
identify an entity of that storage type, for example a volume group |
135 | 135 |
name for LVM storage or a file for file storage. |
136 | 136 |
|
b/qa/qa_node.py | ||
---|---|---|
114 | 114 |
"""gnt-node storage""" |
115 | 115 |
master = qa_config.GetMasterNode() |
116 | 116 |
|
117 |
# FIXME: test all storage_types in constants.VALID_STORAGE_TYPES
|
|
117 |
# FIXME: test all storage_types in constants.STORAGE_TYPES |
|
118 | 118 |
# as soon as they are implemented. |
119 | 119 |
enabled_storage_types = qa_config.GetEnabledStorageTypes() |
120 | 120 |
testable_storage_types = list(set(enabled_storage_types).intersection( |
b/test/py/ganeti.backend_unittest.py | ||
---|---|---|
776 | 776 |
backend._ApplyStorageInfoFunction = mock.Mock( |
777 | 777 |
return_value=self._SOME_RESULT) |
778 | 778 |
storage_units = [(st, st + "_key", [st + "_params"]) for st in |
779 |
constants.VALID_STORAGE_TYPES]
|
|
779 |
constants.STORAGE_TYPES] |
|
780 | 780 |
|
781 | 781 |
backend.GetNodeInfo(storage_units, None) |
782 | 782 |
|
783 | 783 |
call_args_list = backend._ApplyStorageInfoFunction.call_args_list |
784 |
self.assertEqual(len(constants.VALID_STORAGE_TYPES), len(call_args_list))
|
|
784 |
self.assertEqual(len(constants.STORAGE_TYPES), len(call_args_list)) |
|
785 | 785 |
for call in call_args_list: |
786 | 786 |
storage_type, storage_key, storage_params = call[0] |
787 | 787 |
self.assertEqual(storage_type + "_key", storage_key) |
788 | 788 |
self.assertEqual([storage_type + "_params"], storage_params) |
789 |
self.assertTrue(storage_type in constants.VALID_STORAGE_TYPES)
|
|
789 |
self.assertTrue(storage_type in constants.STORAGE_TYPES) |
|
790 | 790 |
backend._ApplyStorageInfoFunction = orig_fn |
791 | 791 |
|
792 | 792 |
|
b/test/py/ganeti.utils.storage_unittest.py | ||
---|---|---|
111 | 111 |
def setUp(self): |
112 | 112 |
self._space_info = [ |
113 | 113 |
{"type": st, "name": st + "_key", "storage_size": 0, "storage_free": 0} |
114 |
for st in constants.VALID_STORAGE_TYPES]
|
|
114 |
for st in constants.STORAGE_TYPES] |
|
115 | 115 |
|
116 | 116 |
def testValidLookup(self): |
117 | 117 |
query_type = constants.ST_LVM_PV |
Also available in: Unified diff