Merge "Add compute_feature_enabled.attach_encrypted_volume config option"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 1f287c8..ffd0b91 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -428,6 +428,12 @@
 # value)
 #preserve_ports = false
 
+# Does the test environment support attaching an encrypted volume to a
+# running server instance? This may depend on the combination of
+# compute_driver in nova and the volume_driver(s) in cinder. (boolean
+# value)
+#attach_encrypted_volume = true
+
 
 [dashboard]
 
diff --git a/tempest/config.py b/tempest/config.py
index 5628ec9..a52f74c 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -391,7 +391,13 @@
                 default=False,
                 help='Does Nova preserve preexisting ports from Neutron '
                      'when deleting an instance? This should be set to True '
-                     'if testing Kilo+ Nova.')
+                     'if testing Kilo+ Nova.'),
+    cfg.BoolOpt('attach_encrypted_volume',
+                default=True,
+                help='Does the test environment support attaching an '
+                     'encrypted volume to a running server instance? This may '
+                     'depend on the combination of compute_driver in nova and '
+                     'the volume_driver(s) in cinder.'),
 ]
 
 
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index e6912d8..b66eb59 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -13,9 +13,12 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest import config
 from tempest.scenario import manager
 from tempest import test
 
+CONF = config.CONF
+
 
 class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest):
 
@@ -31,6 +34,12 @@
         * Attaches and detaches the encrypted volume to the instance
     """
 
+    @classmethod
+    def skip_checks(cls):
+        super(TestEncryptedCinderVolumes, cls).skip_checks()
+        if not CONF.compute_feature_enabled.attach_encrypted_volume:
+            raise cls.skipException('Encrypted volume attach is not supported')
+
     def launch_instance(self):
         self.glance_image_create()
         self.nova_boot()