Commit 33c730a2 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Add constants for storage types to constants.py



This patch adds the currently known and used storage methods to the
constants.py file. Note that storage types are different from disk
templates. For example both disk templates, drbd and plain, use lvm
storage types.

The rapi documentation asserts that valid storage types are limited
to lvm and file. With the extension of storage types, this is not true
anymore, but the implementation of listing storage units is not
implemented for the new types. We disable the assert for now, adding
a fixme to extend it once the listing of storage units is extended
for the new types as well.

'gnt-node list-storage' currently does not support any other storage
type than 'lvm' and 'file'. We limit the QA to storage types that are
currently implemented for this operation.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 011a19bf
......@@ -2092,7 +2092,8 @@ Manages storage units on the node.
``GET``
~~~~~~~
.. pyassert::
FIXME: enable ".. pyassert::" again when all storage types are
implemented::
constants.VALID_STORAGE_TYPES == set([constants.ST_FILE,
constants.ST_LVM_PV,
......
......@@ -376,6 +376,27 @@ HKR_SUCCESS = 2
ST_FILE = "file"
ST_LVM_PV = "lvm-pv"
ST_LVM_VG = "lvm-vg"
ST_DISKLESS = "diskless"
ST_SHARED_FILE = "sharedfile"
ST_BLOCK = "blockdev"
ST_RADOS = "rados"
ST_EXT = "ext"
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
ST_FILE,
ST_LVM_PV,
ST_LVM_VG,
ST_DISKLESS,
ST_SHARED_FILE,
ST_BLOCK,
ST_RADOS,
ST_EXT,
])
# Per default, only lvm is enabled.
DEFAULT_ENABLED_STORAGE_TYPES = compat.UniqueFrozenset([
ST_LVM_VG,
])
# Storage fields
# first two are valid in LU context only, not passed to backend
......@@ -401,12 +422,6 @@ VALID_STORAGE_FIELDS = compat.UniqueFrozenset([
SF_ALLOCATABLE,
])
VALID_STORAGE_TYPES = compat.UniqueFrozenset([
ST_FILE,
ST_LVM_PV,
ST_LVM_VG,
])
MODIFIABLE_STORAGE_FIELDS = {
ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
}
......
......@@ -114,7 +114,10 @@ def TestNodeStorage():
"""gnt-node storage"""
master = qa_config.GetMasterNode()
for storage_type in constants.VALID_STORAGE_TYPES:
# FIXME: test all storage_types in constants.VALID_STORAGE_TYPES
# as soon as they are implemented.
for storage_type in [constants.ST_FILE, constants.ST_LVM_VG,
constants.ST_LVM_PV]:
cmd = ["gnt-node", "list-storage", "--storage-type", storage_type]
......
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