Commit d8e55568 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Rename VALID_STORAGE_TYPES to STORAGE_TYPES



For consistency, this patch renames 'VALID_STORAGE_TYPES'
to 'STORAGE_TYPES', because the set of valid disk
templates is also just names 'DISK_TEMPLATES'.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0b6c56bb
......@@ -2112,9 +2112,9 @@ Manages storage units on the node.
FIXME: enable ".. pyassert::" again when all storage types are
implemented::
constants.VALID_STORAGE_TYPES == set([constants.ST_FILE,
constants.ST_LVM_PV,
constants.ST_LVM_VG])
constants.STORAGE_TYPES == set([constants.ST_FILE,
constants.ST_LVM_PV,
constants.ST_LVM_VG])
Requests a list of storage units on a node. Requires the parameters
``storage_type`` (one of :pyeval:`constants.ST_FILE`,
......
......@@ -1101,7 +1101,7 @@ def CheckStorageTypeEnabled(cluster, storage_type):
"""
assert storage_type is not None
assert storage_type in constants.VALID_STORAGE_TYPES
assert storage_type in constants.STORAGE_TYPES
# special case for lvm-pv, because it cannot be enabled
# via disk templates
if storage_type == constants.ST_LVM_PV:
......
......@@ -384,7 +384,7 @@ ST_LVM_PV = "lvm-pv"
ST_LVM_VG = "lvm-vg"
ST_RADOS = "rados"
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
STORAGE_TYPES = compat.UniqueFrozenset([
ST_BLOCK,
ST_DISKLESS,
ST_EXT,
......
......@@ -360,7 +360,7 @@ def _CheckStorageType(storage_type):
"""Ensure a given storage type is valid.
"""
if storage_type not in constants.VALID_STORAGE_TYPES:
if storage_type not in constants.STORAGE_TYPES:
raise errors.OpPrereqError("Unknown storage type: %s" % storage_type,
errors.ECODE_INVAL)
return True
......
......@@ -130,7 +130,7 @@ def GetStorageUnitsOfCluster(cfg, include_spindles=False):
@rtype: list of tuples (string, string)
@return: list of storage units, each storage unit being a tuple of
(storage_type, storage_key); storage_type is in
C{constants.VALID_STORAGE_TYPES} and the storage_key a string to
C{constants.STORAGE_TYPES} and the storage_key a string to
identify an entity of that storage type, for example a volume group
name for LVM storage or a file for file storage.
......
......@@ -114,7 +114,7 @@ def TestNodeStorage():
"""gnt-node storage"""
master = qa_config.GetMasterNode()
# FIXME: test all storage_types in constants.VALID_STORAGE_TYPES
# FIXME: test all storage_types in constants.STORAGE_TYPES
# as soon as they are implemented.
enabled_storage_types = qa_config.GetEnabledStorageTypes()
testable_storage_types = list(set(enabled_storage_types).intersection(
......
......@@ -776,17 +776,17 @@ class TestGetNodeInfo(unittest.TestCase):
backend._ApplyStorageInfoFunction = mock.Mock(
return_value=self._SOME_RESULT)
storage_units = [(st, st + "_key", [st + "_params"]) for st in
constants.VALID_STORAGE_TYPES]
constants.STORAGE_TYPES]
backend.GetNodeInfo(storage_units, None)
call_args_list = backend._ApplyStorageInfoFunction.call_args_list
self.assertEqual(len(constants.VALID_STORAGE_TYPES), len(call_args_list))
self.assertEqual(len(constants.STORAGE_TYPES), len(call_args_list))
for call in call_args_list:
storage_type, storage_key, storage_params = call[0]
self.assertEqual(storage_type + "_key", storage_key)
self.assertEqual([storage_type + "_params"], storage_params)
self.assertTrue(storage_type in constants.VALID_STORAGE_TYPES)
self.assertTrue(storage_type in constants.STORAGE_TYPES)
backend._ApplyStorageInfoFunction = orig_fn
......
......@@ -111,7 +111,7 @@ class TestLookupSpaceInfoByStorageType(unittest.TestCase):
def setUp(self):
self._space_info = [
{"type": st, "name": st + "_key", "storage_size": 0, "storage_free": 0}
for st in constants.VALID_STORAGE_TYPES]
for st in constants.STORAGE_TYPES]
def testValidLookup(self):
query_type = constants.ST_LVM_PV
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment