Add option to support volume_type in volume creation

The volume creation uses default volume type from the backend. In
case of multiple backend, at the moment there is no option to test
volume test cases with volume type which is not default volume type.

Add a new config volume_type in tempest.conf.
Change the code to create volumes with volume_type mentioned in
the config.
Make sure when volume_type is not specified then volume will be
created with default volume type.

Change-Id: I1b4601e2ce6c83ec727b6dea65c67cacbfcfe957
This commit is contained in:
Ansuman Bebarta 2021-02-16 18:48:33 +05:30
parent ef8e054b6b
commit 46d540d33e
2 changed files with 10 additions and 0 deletions

View File

@ -129,6 +129,13 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
name = data_utils.rand_name(cls.__name__ + '-Volume')
kwargs['name'] = name
if CONF.volume.volume_type and 'volume_type' not in kwargs:
# If volume_type is not provided in config then no need to
# add a volume type and
# if volume_type has already been added by child class then
# no need to override.
kwargs['volume_type'] = CONF.volume.volume_type
if CONF.compute.compute_volume_common_az:
kwargs.setdefault('availability_zone',
CONF.compute.compute_volume_common_az)

View File

@ -965,6 +965,9 @@ VolumeGroup = [
default=['BACKEND_1', 'BACKEND_2'],
help='A list of backend names separated by comma. '
'The backend name must be declared in cinder.conf'),
cfg.StrOpt('volume_type',
default='',
help='Volume type to be used while creating volume.'),
cfg.StrOpt('storage_protocol',
default='iSCSI',
help='Backend protocol to target when creating volume types'),