Merge "Deprecate `volume_image_dep_tests`"
diff --git a/.zuul.yaml b/.zuul.yaml
index e0a0b2e..5d0c956 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -23,9 +23,9 @@
# As per the Tempest "Stable Branch Support Policy", Tempest will only
# support the "Maintained" stable branches, so only jobs for the
# current stable branches should be listed here.
+ - cinder-tempest-plugin-basic-2024-2
- cinder-tempest-plugin-basic-2024-1
- cinder-tempest-plugin-basic-2023-2
- - cinder-tempest-plugin-basic-2023-1
- cinder-tempest-plugin-protection-functional
gate:
jobs:
@@ -36,9 +36,9 @@
- cinder-tempest-plugin-cbak-ceph
experimental:
jobs:
+ - cinder-tempest-plugin-cbak-ceph-2024-2
- cinder-tempest-plugin-cbak-ceph-2024-1
- cinder-tempest-plugin-cbak-ceph-2023-2
- - cinder-tempest-plugin-cbak-ceph-2023-1
- job:
name: cinder-tempest-plugin-protection-functional
@@ -110,6 +110,7 @@
vars:
configure_swap_size: 8192
tempest_test_regex: '(^tempest\.(api|scenario)|(^cinder_tempest_plugin))'
+ tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
tox_envlist: all
devstack_localrc:
CINDER_LVM_TYPE: thin
@@ -127,6 +128,8 @@
volume_revert: True
devstack_services:
barbican: true
+ # explicitly enable c-bak, as it may be disabled in the parent job
+ c-bak: true
tempest_plugins:
- cinder-tempest-plugin
irrelevant-files:
@@ -144,8 +147,6 @@
# from the 21st century!
branches: ^(master|(stable/(202[4-9]|20[3-9]\d|2[1-9]\d\d|[3-9]\d\d\d))\.[12])$
parent: cinder-tempest-plugin-lvm-barbican-base-abstract
- vars:
- tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
- job:
name: cinder-tempest-plugin-lvm-barbican-base
@@ -164,7 +165,6 @@
vars:
fetch_subunit_output_additional_dirs:
- "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}"
- tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
- job:
name: cinder-tempest-plugin-lvm-barbican-base
@@ -189,7 +189,6 @@
vars:
fetch_subunit_output_additional_dirs:
- "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}"
- tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
- job:
name: cinder-tempest-plugin-lvm-barbican-base
@@ -214,7 +213,6 @@
vars:
fetch_subunit_output_additional_dirs:
- "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/cinderlib'].src_dir }}"
- tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
- job:
name: cinder-tempest-plugin-lvm-barbican-base
@@ -232,8 +230,6 @@
required-projects:
- name: opendev.org/openstack/cinder-tempest-plugin
override-checkout: 1.3.0
- vars:
- tempest_test_exclude_list: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/tempest"].src_dir }}/tools/tempest-integrated-gate-storage-exclude-list.txt'
- job:
name: cinder-tempest-plugin-lvm-barbican-base
@@ -254,6 +250,11 @@
Integration tests that runs with the ceph devstack plugin, py3
and enable the backup service.
vars:
+ # FIXME: change I29b1af0a4034decad to tempest added image format tests that
+ # cannot pass in this job because the image data takes a optimized path that
+ # bypasses nova's checks. Until the nova team decides on a strategy to handle
+ # this issue, we skip these tests.
+ tempest_exclude_regex: (tempest.api.image.v2.test_images_formats.ImagesFormatTest.test_compute_rejects)
configure_swap_size: 4096
devstack_local_conf:
test-config:
@@ -267,6 +268,12 @@
timeout: 10800
- job:
+ name: cinder-tempest-plugin-cbak-ceph-2024-2
+ parent: cinder-tempest-plugin-cbak-ceph
+ nodeset: openstack-single-node-jammy
+ override-checkout: stable/2024.2
+
+- job:
name: cinder-tempest-plugin-cbak-ceph-2024-1
parent: cinder-tempest-plugin-cbak-ceph
nodeset: openstack-single-node-jammy
@@ -278,12 +285,6 @@
nodeset: openstack-single-node-jammy
override-checkout: stable/2023.2
-- job:
- name: cinder-tempest-plugin-cbak-ceph-2023-1
- parent: cinder-tempest-plugin-cbak-ceph
- nodeset: openstack-single-node-jammy
- override-checkout: stable/2023.1
-
# variant for pre-Ussuri branches (no volume revert for Ceph),
# should this job be used on those branches
- job:
@@ -304,15 +305,7 @@
parent: cinder-tempest-plugin-lvm-barbican-base
vars:
devstack_localrc:
- CINDER_ISCSI_HELPER: lioadm
-
-- job:
- name: cinder-tempest-plugin-lvm-lio-barbican-centos-8-stream
- parent: cinder-tempest-plugin-lvm-lio-barbican
- nodeset: devstack-single-node-centos-8-stream
- description: |
- This jobs configures Cinder with LVM, LIO, barbican and
- runs tempest tests and cinderlib tests on CentOS Stream 8.
+ CINDER_TARGET_HELPER: lioadm
- job:
name: cinder-tempest-plugin-lvm-lio-barbican-centos-9-stream
@@ -376,7 +369,7 @@
parent: cinder-tempest-plugin-lvm-barbican-base
vars:
devstack_localrc:
- CINDER_ISCSI_HELPER: tgtadm
+ CINDER_TARGET_HELPER: tgtadm
- job:
name: cinder-tempest-plugin-cbak-s3
@@ -414,6 +407,12 @@
- ^releasenotes/.*$
- job:
+ name: cinder-tempest-plugin-basic-2024-2
+ parent: cinder-tempest-plugin-basic
+ nodeset: openstack-single-node-jammy
+ override-checkout: stable/2024.2
+
+- job:
name: cinder-tempest-plugin-basic-2024-1
parent: cinder-tempest-plugin-basic
nodeset: openstack-single-node-jammy
@@ -424,9 +423,3 @@
parent: cinder-tempest-plugin-basic
nodeset: openstack-single-node-jammy
override-checkout: stable/2023.2
-
-- job:
- name: cinder-tempest-plugin-basic-2023-1
- parent: cinder-tempest-plugin-basic
- nodeset: openstack-single-node-jammy
- override-checkout: stable/2023.1
diff --git a/babel.cfg b/babel.cfg
deleted file mode 100644
index 15cd6cb..0000000
--- a/babel.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[python: **.py]
-
diff --git a/cinder_tempest_plugin/api/volume/admin/test_consistencygroups.py b/cinder_tempest_plugin/api/volume/admin/test_consistencygroups.py
index 42c78f1..191ecb2 100644
--- a/cinder_tempest_plugin/api/volume/admin/test_consistencygroups.py
+++ b/cinder_tempest_plugin/api/volume/admin/test_consistencygroups.py
@@ -20,18 +20,11 @@
from tempest.lib import decorators
from cinder_tempest_plugin.api.volume import base
-from cinder_tempest_plugin import cinder_clients
CONF = config.CONF
class ConsistencyGroupsV2Test(base.BaseVolumeAdminTest):
- @classmethod
- def setup_clients(cls):
- super(ConsistencyGroupsV2Test, cls).setup_clients()
-
- manager = cinder_clients.Manager(cls.os_admin)
- cls.consistencygroups_adm_client = manager.consistencygroups_adm_client
@classmethod
def skip_checks(cls):
@@ -41,16 +34,16 @@
"feature disabled")
def _delete_consistencygroup(self, cg_id):
- self.consistencygroups_adm_client.delete_consistencygroup(cg_id)
+ self.admin_consistencygroups_client.delete_consistencygroup(cg_id)
vols = self.admin_volume_client.list_volumes(detail=True)['volumes']
for vol in vols:
if vol['consistencygroup_id'] == cg_id:
self.admin_volume_client.wait_for_resource_deletion(vol['id'])
- self.consistencygroups_adm_client.wait_for_consistencygroup_deletion(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_deletion(
cg_id)
def _delete_cgsnapshot(self, cgsnapshot_id, cg_id):
- self.consistencygroups_adm_client.delete_cgsnapshot(cgsnapshot_id)
+ self.admin_consistencygroups_client.delete_cgsnapshot(cgsnapshot_id)
vols = self.admin_volume_client.list_volumes(detail=True)['volumes']
snapshots = self.os_admin.snapshots_v2_client.list_snapshots(
detail=True)['snapshots']
@@ -60,7 +53,7 @@
vol['id'] == snap['volume_id']):
(self.snapshots_client.
wait_for_resource_deletion(snap['id']))
- self.consistencygroups_adm_client.wait_for_cgsnapshot_deletion(
+ self.admin_consistencygroups_client.wait_for_cgsnapshot_deletion(
cgsnapshot_id)
@decorators.idempotent_id('3fe776ba-ec1f-4e6c-8d78-4b14c3a7fc44')
@@ -73,10 +66,10 @@
# Create CG
cg_name = data_utils.rand_name('CG')
create_consistencygroup = (
- self.consistencygroups_adm_client.create_consistencygroup)
+ self.admin_consistencygroups_client.create_consistencygroup)
cg = create_consistencygroup(volume_type['id'],
name=cg_name)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg['id'], 'available')
self.assertEqual(cg_name, cg['name'])
@@ -92,12 +85,12 @@
volume['id'], 'available')
# Get a given CG
- cg = self.consistencygroups_adm_client.show_consistencygroup(
+ cg = self.admin_consistencygroups_client.show_consistencygroup(
cg['id'])['consistencygroup']
self.assertEqual(cg_name, cg['name'])
# Get all CGs with detail
- cgs = self.consistencygroups_adm_client.list_consistencygroups(
+ cgs = self.admin_consistencygroups_client.list_consistencygroups(
detail=True)['consistencygroups']
self.assertIn((cg['name'], cg['id']),
[(m['name'], m['id']) for m in cgs])
@@ -117,10 +110,10 @@
# Create CG
cg_name = data_utils.rand_name('CG')
create_consistencygroup = (
- self.consistencygroups_adm_client.create_consistencygroup)
+ self.admin_consistencygroups_client.create_consistencygroup)
cg = create_consistencygroup(volume_type['id'],
name=cg_name)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg['id'], 'available')
self.assertEqual(cg_name, cg['name'])
@@ -137,10 +130,10 @@
# Create cgsnapshot
cgsnapshot_name = data_utils.rand_name('cgsnapshot')
create_cgsnapshot = (
- self.consistencygroups_adm_client.create_cgsnapshot)
+ self.admin_consistencygroups_client.create_cgsnapshot)
cgsnapshot = create_cgsnapshot(cg['id'],
name=cgsnapshot_name)['cgsnapshot']
- self.consistencygroups_adm_client.wait_for_cgsnapshot_status(
+ self.admin_consistencygroups_client.wait_for_cgsnapshot_status(
cgsnapshot['id'], 'available')
self.assertEqual(cgsnapshot_name, cgsnapshot['name'])
snapshots = self.os_admin.snapshots_v2_client.list_snapshots(
@@ -152,12 +145,12 @@
snap['id'], 'available')
# Get a given CG snapshot
- cgsnapshot = self.consistencygroups_adm_client.show_cgsnapshot(
+ cgsnapshot = self.admin_consistencygroups_client.show_cgsnapshot(
cgsnapshot['id'])['cgsnapshot']
self.assertEqual(cgsnapshot_name, cgsnapshot['name'])
# Get all CG snapshots with detail
- cgsnapshots = self.consistencygroups_adm_client.list_cgsnapshots(
+ cgsnapshots = self.admin_consistencygroups_client.list_cgsnapshots(
detail=True)['cgsnapshots']
self.assertIn((cgsnapshot['name'], cgsnapshot['id']),
[(m['name'], m['id']) for m in cgsnapshots])
@@ -177,10 +170,10 @@
# Create CG
cg_name = data_utils.rand_name('CG')
create_consistencygroup = (
- self.consistencygroups_adm_client.create_consistencygroup)
+ self.admin_consistencygroups_client.create_consistencygroup)
cg = create_consistencygroup(volume_type['id'],
name=cg_name)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg['id'], 'available')
self.assertEqual(cg_name, cg['name'])
@@ -197,10 +190,10 @@
# Create cgsnapshot
cgsnapshot_name = data_utils.rand_name('cgsnapshot')
create_cgsnapshot = (
- self.consistencygroups_adm_client.create_cgsnapshot)
+ self.admin_consistencygroups_client.create_cgsnapshot)
cgsnapshot = create_cgsnapshot(cg['id'],
name=cgsnapshot_name)['cgsnapshot']
- self.consistencygroups_adm_client.wait_for_cgsnapshot_status(
+ self.admin_consistencygroups_client.wait_for_cgsnapshot_status(
cgsnapshot['id'], 'available')
self.assertEqual(cgsnapshot_name, cgsnapshot['name'])
snapshots = self.snapshots_client.list_snapshots(
@@ -213,10 +206,12 @@
# Create CG from CG snapshot
cg_name2 = data_utils.rand_name('CG_from_snap')
create_consistencygroup2 = (
- self.consistencygroups_adm_client.create_consistencygroup_from_src)
+ self.admin_consistencygroups_client.
+ create_consistencygroup_from_src
+ )
cg2 = create_consistencygroup2(cgsnapshot_id=cgsnapshot['id'],
name=cg_name2)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg2['id'], 'available')
self.assertEqual(cg_name2, cg2['name'])
vols = self.admin_volume_client.list_volumes(
@@ -242,10 +237,10 @@
# Create CG
cg_name = data_utils.rand_name('CG')
create_consistencygroup = (
- self.consistencygroups_adm_client.create_consistencygroup)
+ self.admin_consistencygroups_client.create_consistencygroup)
cg = create_consistencygroup(volume_type['id'],
name=cg_name)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg['id'], 'available')
self.assertEqual(cg_name, cg['name'])
@@ -262,10 +257,12 @@
# Create CG from CG
cg_name2 = data_utils.rand_name('CG_from_cg')
create_consistencygroup2 = (
- self.consistencygroups_adm_client.create_consistencygroup_from_src)
+ self.admin_consistencygroups_client.
+ create_consistencygroup_from_src
+ )
cg2 = create_consistencygroup2(source_cgid=cg['id'],
name=cg_name2)['consistencygroup']
- self.consistencygroups_adm_client.wait_for_consistencygroup_status(
+ self.admin_consistencygroups_client.wait_for_consistencygroup_status(
cg2['id'], 'available')
self.assertEqual(cg_name2, cg2['name'])
vols = self.admin_volume_client.list_volumes(
diff --git a/cinder_tempest_plugin/api/volume/base.py b/cinder_tempest_plugin/api/volume/base.py
index c0f53bd..e049ff3 100644
--- a/cinder_tempest_plugin/api/volume/base.py
+++ b/cinder_tempest_plugin/api/volume/base.py
@@ -50,6 +50,9 @@
cls.backups_client = cls.os_primary.backups_client_latest
cls.volumes_client = cls.os_primary.volumes_client_latest
cls.snapshots_client = cls.os_primary.snapshots_client_latest
+ cls.volume_revert_client = (
+ cls.os_primary.volume_revert_v3.VolumeRevertClient()
+ )
@classmethod
def setup_credentials(cls):
@@ -88,6 +91,10 @@
name = data_utils.rand_name(cls.__name__ + '-Volume')
kwargs['name'] = name
+ if CONF.compute.compute_volume_common_az:
+ kwargs.setdefault('availability_zone',
+ CONF.compute.compute_volume_common_az)
+
volume = cls.volumes_client.create_volume(**kwargs)['volume']
cls.addClassResourceCleanup(
cls.volumes_client.wait_for_resource_deletion, volume['id'])
@@ -196,6 +203,9 @@
cls.admin_volume_types_client = cls.os_admin.volume_types_client_latest
cls.admin_backups_client = cls.os_admin.backups_client_latest
cls.admin_volume_client = cls.os_admin.volumes_client_latest
+ cls.admin_consistencygroups_client = (
+ cls.os_admin.consistencygroups_v3.ConsistencyGroupsClient()
+ )
@classmethod
def create_volume_type(cls, name=None, **kwargs):
diff --git a/cinder_tempest_plugin/api/volume/test_volume_revert.py b/cinder_tempest_plugin/api/volume/test_volume_revert.py
index 2c4d6bd..c585c3c 100644
--- a/cinder_tempest_plugin/api/volume/test_volume_revert.py
+++ b/cinder_tempest_plugin/api/volume/test_volume_revert.py
@@ -19,7 +19,6 @@
from tempest.lib import exceptions
from cinder_tempest_plugin.api.volume import base
-from cinder_tempest_plugin import cinder_clients
CONF = config.CONF
@@ -33,13 +32,6 @@
if not CONF.volume_feature_enabled.volume_revert:
raise cls.skipException("Cinder volume revert feature disabled")
- @classmethod
- def setup_clients(cls):
- super(VolumeRevertTests, cls).setup_clients()
-
- manager = cinder_clients.Manager(cls.os_primary)
- cls.volume_revert_client = manager.volume_revert_client
-
def setUp(self):
super(VolumeRevertTests, self).setUp()
# Create volume
diff --git a/cinder_tempest_plugin/cinder_clients.py b/cinder_tempest_plugin/cinder_clients.py
index f4c7c0e..b27d22c 100644
--- a/cinder_tempest_plugin/cinder_clients.py
+++ b/cinder_tempest_plugin/cinder_clients.py
@@ -14,27 +14,19 @@
# under the License.
from tempest import config
-
-from cinder_tempest_plugin.services import consistencygroups_client
-from cinder_tempest_plugin.services import volume_revert_client
+from tempest.lib.services import clients
CONF = config.CONF
-class Manager(object):
- def __init__(self, base_manager):
- params = {
- 'service': CONF.volume.catalog_type,
- 'region': CONF.volume.region or CONF.identity.region,
- 'endpoint_type': CONF.volume.endpoint_type,
- 'build_interval': CONF.volume.build_interval,
- 'build_timeout': CONF.volume.build_timeout
- }
- params.update(base_manager.default_params)
- auth_provider = base_manager.auth_provider
+class Clients(clients.ServiceClients):
+ """Tempest stable service clients and loaded plugins service clients"""
- self.consistencygroups_adm_client = (
- consistencygroups_client.ConsistencyGroupsClient(auth_provider,
- **params))
- self.volume_revert_client = (
- volume_revert_client.VolumeRevertClient(auth_provider, **params))
+ def __init__(self, credentials, service=None):
+ """Emulate the interface of Tempest's clients.Manager"""
+ # Identity settings
+ if CONF.identity.auth_version == 'v2':
+ identity_uri = CONF.identity.uri
+ else:
+ identity_uri = CONF.identity.uri_v3
+ super(Clients, self).__init__(credentials, identity_uri)
diff --git a/cinder_tempest_plugin/plugin.py b/cinder_tempest_plugin/plugin.py
index 5d170e5..79c835c 100644
--- a/cinder_tempest_plugin/plugin.py
+++ b/cinder_tempest_plugin/plugin.py
@@ -69,3 +69,26 @@
project_config.barbican_service_option))
return opt_lists
+
+ def get_service_clients(self):
+ volumes_config = config.service_client_config('volume')
+
+ consistencygroups_params = {
+ 'name': 'consistencygroups_v3',
+ 'service_version': 'consistencygroups.v3',
+ 'module_path': 'cinder_tempest_plugin.services.'
+ 'consistencygroups_client',
+ 'client_names': ['ConsistencyGroupsClient'],
+ }
+ consistencygroups_params.update(volumes_config)
+
+ volumerevert_params = {
+ 'name': 'volume_revert_v3',
+ 'service_version': 'volume_revert.v3',
+ 'module_path': 'cinder_tempest_plugin.services.'
+ 'volume_revert_client',
+ 'client_names': ['VolumeRevertClient'],
+ }
+ volumerevert_params.update(volumes_config)
+
+ return [consistencygroups_params, volumerevert_params]
diff --git a/cinder_tempest_plugin/rbac/v3/test_snapshots.py b/cinder_tempest_plugin/rbac/v3/test_snapshots.py
index f11da42..14377a9 100644
--- a/cinder_tempest_plugin/rbac/v3/test_snapshots.py
+++ b/cinder_tempest_plugin/rbac/v3/test_snapshots.py
@@ -17,6 +17,8 @@
from tempest.lib import decorators
from tempest.lib import exceptions
+import testtools
+
from cinder_tempest_plugin.rbac.v3 import base as rbac_base
CONF = config.CONF
@@ -309,10 +311,15 @@
def test_force_delete_snapshot(self):
self._force_delete_snapshot(expected_status=exceptions.Forbidden)
+ # We don't need to skip the unmanage because the failure should happen at
+ # the API level, so it should fail regardless of the driver support for
+ # unmanaging snapshots.
@decorators.idempotent_id('35495666-b663-4c68-ba44-0695e30a6838')
def test_unmanage_snapshot(self):
self._unmanage_snapshot(expected_status=exceptions.Forbidden)
+ @testtools.skipUnless(CONF.volume_feature_enabled.manage_snapshot,
+ 'manage snapshots are disabled')
@decorators.idempotent_id('d2d1326d-fb47-4448-a1e1-2d1219d30fd5')
def test_manage_snapshot(self):
self._manage_snapshot(
@@ -362,10 +369,15 @@
def test_force_delete_snapshot(self):
self._force_delete_snapshot(expected_status=exceptions.Forbidden)
+ # We don't need to skip the unmanage because the failure should happen at
+ # the API level, so it should fail regardless of the driver support for
+ # unmanaging snapshots.
@decorators.idempotent_id('dd7da3da-68ef-42f5-af1d-29803a4a04fd')
def test_unmanage_snapshot(self):
self._unmanage_snapshot(expected_status=exceptions.Forbidden)
+ @testtools.skipUnless(CONF.volume_feature_enabled.manage_snapshot,
+ 'manage snapshots are disabled')
@decorators.idempotent_id('c2501d05-9bca-42d7-9ab5-c0d9133e762f')
def test_manage_snapshot(self):
self._manage_snapshot(
diff --git a/cinder_tempest_plugin/rbac/v3/test_volume_types.py b/cinder_tempest_plugin/rbac/v3/test_volume_types.py
index cdbc341..e4e161e 100644
--- a/cinder_tempest_plugin/rbac/v3/test_volume_types.py
+++ b/cinder_tempest_plugin/rbac/v3/test_volume_types.py
@@ -20,7 +20,24 @@
class RbacV3VolumeTypesTests(rbac_base.VolumeV3RbacBaseTests):
min_microversion = '3.3'
- extra_spec_key = 'key1'
+ extra_specs = {
+ 'key1': 'value1',
+ 'multiattach': '<is> False',
+ 'volume_backend_name': 'test-backend-name',
+ 'RESKEY:availability_zones': 'test-az',
+ 'replication_enabled': '<is> False'
+ }
+ extra_specs_keys = list(extra_specs.keys())
+ expected_extra_specs = {
+ "reader": [
+ 'multiattach', 'RESKEY:availability_zones', 'replication_enabled'
+ ],
+ "member": [
+ 'multiattach', 'RESKEY:availability_zones', 'replication_enabled'
+ ],
+ "admin": extra_specs_keys
+ }
+
encryption_type_key_cipher = 'cipher'
create_kwargs = {
'provider': 'LuksEncryptor',
@@ -52,10 +69,9 @@
# create a volume type
if not name:
name = data_utils.rand_name("volume-type")
- extra_specs = {cls.extra_spec_key: 'value1'}
params = {'name': name,
'description': "description",
- 'extra_specs': extra_specs,
+ 'extra_specs': cls.extra_specs,
'os-volume-type-access:is_public': True}
volume_type = cls.admin_types_client.create_volume_type(
**params
@@ -66,6 +82,9 @@
cls.encryption_type = \
cls.admin_encryption_types_client.create_encryption_type(
volume_type['id'], **cls.create_kwargs)['encryption']
+ # NOTE: strictly speaking, this is NOT a volume_type field;
+ # we save it for convenience in these tests
+ volume_type['encryption_id'] = cls.encryption_type['encryption_id']
if cleanup:
cls.addClassResourceCleanup(
@@ -74,6 +93,28 @@
return volume_type
+ def _extra_specs_content_validator(self, client, extra_specs):
+ """Validation of volume type's extra specs content
+
+ Addition for feature:
+ https://specs.openstack.org/openstack/cinder-specs/specs/xena/
+ expose-cinder-user-visible-extra-specs-spec.html
+
+ This feature allows 'readers' and 'members' to "see" volume type's
+ extra specs:
+ 'multiattach', 'RESKEY:availability_zones' and 'replication_enabled'
+
+ Args:
+ client: Client object to be used
+ extra_specs: extra_specs dict from response
+
+ Returns:
+ Boolean: True if lists are equal, false otherwise
+ """
+ role = client.user.split('-')[-1]
+ return (sorted(list(extra_specs.keys())) ==
+ sorted(self.expected_extra_specs[role]))
+
def _update_volume_type(self, expected_status):
"""Update volume type"""
self.do_request(
@@ -112,30 +153,65 @@
expected_status=expected_status,
volume_type_id=self.volume_type['id']
)['extra_specs']
- self.assertIn(
- self.extra_spec_key,
- list(extra_specs.keys()),
- message=f"Key '{self.extra_spec_key}' not found in extra_specs."
+ self.assertTrue(
+ self._extra_specs_content_validator(
+ client=self.client, extra_specs=extra_specs
+ )
)
def _show_extra_spec_for_volume_type(self, expected_status):
"""Show extra_spec for a volume type"""
- self.do_request(
+
+ # Using 'multiattach' extra spec because all admin, member and readers
+ # should be able to "see".
+ spec = self.do_request(
method='show_volume_type_extra_specs',
expected_status=expected_status,
volume_type_id=self.volume_type['id'],
- extra_specs_name=self.extra_spec_key
+ extra_specs_name='multiattach'
+ )
+ self.assertEqual(spec['multiattach'], self.extra_specs['multiattach'])
+
+ # Using 'volume_backend_name' extra spec because only admin should
+ # "see" it.
+ role = self.client.user.split('-')[-1]
+ # 'reader' and 'member' will get 404 (NotFound) if they try to show
+ # the extra spec 'volume_backend_name'
+ try:
+ spec = self.do_request(
+ method='show_volume_type_extra_specs',
+ expected_status=expected_status,
+ volume_type_id=self.volume_type['id'],
+ extra_specs_name='volume_backend_name'
+ )
+ except exceptions.NotFound:
+ # NotFound exception should be thrown for
+ # 'reader' and 'member' only
+ self.assertNotEqual(
+ role, 'admin',
+ "NotFound exception was thrown for admin"
+ )
+ return
+
+ # If no exception thrown, then check the content
+ # Only admin should reach to this point
+ self.assertNotIn(
+ role, ['reader', 'member'],
+ "NotFound should be thrown for non admin role"
+ )
+ self.assertEqual(
+ spec['volume_backend_name'],
+ self.extra_specs['volume_backend_name']
)
def _update_extra_spec_for_volume_type(self, expected_status):
"""Update extra_spec for a volume type"""
- spec_name = self.extra_spec_key
- extra_spec = {spec_name: 'updated value'}
+ extra_spec = {'key1': 'key1 updated value'}
self.do_request(
method='update_volume_type_extra_specs',
expected_status=expected_status,
volume_type_id=self.volume_type['id'],
- extra_spec_name=spec_name,
+ extra_spec_name='key1',
extra_specs=extra_spec
)
@@ -147,15 +223,20 @@
method='delete_volume_type_extra_specs',
expected_status=expected_status,
volume_type_id=volume_type['id'],
- extra_spec_name=self.extra_spec_key
+ extra_spec_name='key1'
)
def _show_volume_type_detail(self, expected_status):
"""Show volume type"""
- self.do_request(
+ details = self.do_request(
method='show_volume_type',
expected_status=expected_status,
volume_type_id=self.volume_type['id']
+ )['volume_type']
+ self.assertTrue(
+ self._extra_specs_content_validator(
+ client=self.client, extra_specs=details['extra_specs']
+ )
)
def _show_default_volume_type(self, expected_status):
@@ -181,10 +262,15 @@
def _list_volume_types(self, expected_status):
"""List all volume types"""
- self.do_request(
+ volume_types = self.do_request(
method='list_volume_types',
expected_status=expected_status
- )
+ )['volume_types']
+ for volume_type in volume_types:
+ if volume_type['id'] == self.volume_type['id']:
+ self._extra_specs_content_validator(
+ client=self.client, extra_specs=volume_type['extra_specs']
+ )
def _create_volume_type(self, expected_status):
"""Create a volume type"""
@@ -226,7 +312,8 @@
method='delete_encryption_type',
expected_status=expected_status,
client=self.encryption_types_client,
- volume_type_id=volume_type['id']
+ volume_type_id=volume_type['id'],
+ encryption_id=volume_type['encryption_id']
)
def _create_encryption_type(self, expected_status):
@@ -250,6 +337,7 @@
expected_status=expected_status,
client=self.encryption_types_client,
volume_type_id=self.volume_type['id'],
+ encryption_id=self.volume_type['encryption_id'],
**update_kwargs
)
@@ -275,14 +363,12 @@
expected_status=exceptions.Forbidden
)
- @decorators.skip_because(bug='2018467')
@decorators.idempotent_id('9499752c-3b27-41a3-8f55-4bdba7297f92')
def test_list_all_extra_specs_for_volume_type(self):
self._list_all_extra_specs_for_volume_type(
expected_status=200
)
- @decorators.skip_because(bug='2018467')
@decorators.idempotent_id('a38f7248-3a5b-4e51-8e32-d2dcf9c771ea')
def test_show_extra_spec_for_volume_type(self):
self._show_extra_spec_for_volume_type(expected_status=200)
@@ -364,14 +450,12 @@
expected_status=exceptions.Forbidden
)
- @decorators.skip_because(bug='2018467')
@decorators.idempotent_id('82fd0d34-17b3-4f45-bd2e-728c9a8bff8c')
def test_list_all_extra_specs_for_volume_type(self):
self._list_all_extra_specs_for_volume_type(
expected_status=200
)
- @decorators.skip_because(bug='2018467')
@decorators.idempotent_id('67aa0b40-7c0a-4ae7-8682-fb4f20abd390')
def test_show_extra_spec_for_volume_type(self):
self._show_extra_spec_for_volume_type(expected_status=200)
@@ -457,7 +541,6 @@
expected_status=200
)
- @decorators.skip_because(bug='2018467')
@decorators.idempotent_id('a2cca7b6-0af9-47e5-b8c1-4e0f01822d4e')
def test_show_extra_spec_for_volume_type(self):
self._show_extra_spec_for_volume_type(expected_status=200)
diff --git a/cinder_tempest_plugin/scenario/test_encrypted_volume_transfer.py b/cinder_tempest_plugin/scenario/test_encrypted_volume_transfer.py
index 7232433..bfe33b2 100644
--- a/cinder_tempest_plugin/scenario/test_encrypted_volume_transfer.py
+++ b/cinder_tempest_plugin/scenario/test_encrypted_volume_transfer.py
@@ -41,6 +41,8 @@
@classmethod
def skip_checks(cls):
super(TransferEncryptedVolumeTest, cls).skip_checks()
+ if not CONF.compute_feature_enabled.attach_encrypted_volume:
+ raise cls.skipException('Encrypted volume attach is not supported')
if not CONF.service_available.barbican:
raise cls.skipException('Barbican is required')
diff --git a/cinder_tempest_plugin/scenario/test_volume_multiattach.py b/cinder_tempest_plugin/scenario/test_volume_multiattach.py
index e04610f..4fb266e 100644
--- a/cinder_tempest_plugin/scenario/test_volume_multiattach.py
+++ b/cinder_tempest_plugin/scenario/test_volume_multiattach.py
@@ -71,18 +71,25 @@
# Create a multiattach volume
volume = self.create_volume(volume_type=multiattach_vol_type['id'])
- # Create encrypted volume
- encrypted_volume = self.create_encrypted_volume(
- 'luks', volume_type='luks')
+ # Create a volume with the default volume type
+ default_volume = self.create_volume()
- # Create a normal volume
- simple_volume = self.create_volume()
+ # Create other volume
+ if CONF.compute_feature_enabled.attach_encrypted_volume:
+ other_volume = self.create_encrypted_volume(
+ 'luks', volume_type='luks')
+ else:
+ # Create secondary volume type
+ second_vol_type = self.create_volume_type()
- # Attach normal and encrypted volumes (These volumes are not used in
+ other_volume = self.create_volume(
+ volume_type=second_vol_type['id'])
+
+ # Attach default and secondary volumes (These volumes are not used in
# the current test but is used to emulate a real world scenario
# where different types of volumes will be attached to the server)
- self.attach_volume(server_1, simple_volume)
- self.attach_volume(server_1, encrypted_volume)
+ self.attach_volume(server_1, default_volume)
+ self.attach_volume(server_1, other_volume)
instance_ip = self.get_server_ip(server_1)
diff --git a/cinder_tempest_plugin/services/__init__.py b/cinder_tempest_plugin/services/__init__.py
index e69de29..8be06b7 100644
--- a/cinder_tempest_plugin/services/__init__.py
+++ b/cinder_tempest_plugin/services/__init__.py
@@ -0,0 +1,22 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+from cinder_tempest_plugin.services.consistencygroups_client import \
+ ConsistencyGroupsClient
+from cinder_tempest_plugin.services.volume_revert_client import \
+ VolumeRevertClient
+
+__all__ = [
+ 'ConsistencyGroupsClient',
+ 'VolumeRevertClient'
+]
diff --git a/test-requirements.txt b/test-requirements.txt
index 905ad51..cb279bc 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-hacking>=3.0.1,<3.1 # Apache-2.0
+hacking>=6.1.0,<7.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD