Merge "Fix skipping test volume swap" into mcp/epoxy
diff --git a/tempest/api/compute/admin/test_volume_swap.py b/tempest/api/compute/admin/test_volume_swap.py
index d7abf72..46500cc 100644
--- a/tempest/api/compute/admin/test_volume_swap.py
+++ b/tempest/api/compute/admin/test_volume_swap.py
@@ -30,16 +30,34 @@
super(TestVolumeSwapBase, cls).setup_credentials()
@classmethod
+ def setup_clients(cls):
+ super(TestVolumeSwapBase, cls).setup_clients()
+
+ cls.volume_type_client = cls.os_admin.volume_types_client_latest
+ cls.encryption_client = cls.os_admin.encryption_types_client_latest
+
+ @classmethod
def skip_checks(cls):
super(TestVolumeSwapBase, cls).skip_checks()
if not CONF.service_available.cinder:
raise cls.skipException("Cinder is not available")
if not CONF.compute_feature_enabled.swap_volume:
raise cls.skipException("Swapping volumes is not supported.")
- if CONF.compute_feature_enabled.attach_encrypted_volume:
- raise cls.skipException(
- 'Volume swap is not available for OS configurations '
- 'with crypted volumes.')
+
+ @classmethod
+ def _check_default_volume_type(cls):
+ default_volume_type = cls.volume_type_client.\
+ show_default_volume_type()["volume_type"]["id"]
+ volume_encryption = cls.encryption_client.show_encryption_type(
+ default_volume_type)
+ if volume_encryption and volume_encryption.get("provider"):
+ raise cls.skipException("Not allowed to run this test with "
+ "encrypted volume")
+
+ @classmethod
+ def resource_setup(cls):
+ cls._check_default_volume_type()
+ super(TestVolumeSwapBase, cls).resource_setup()
def wait_for_server_volume_swap(self, server_id, old_volume_id,
new_volume_id):