Merge "Fix test_novnc to adequately validate websocket upgrade" into mcp/stein
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 2e5f706..7b40e5f 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -193,10 +193,6 @@
 There are also options in the ``scenario`` section for images:
 
 #. ``img_file``
-#. ``img_dir``
-#. ``aki_img_file``
-#. ``ari_img_file``
-#. ``ami_img_file``
 #. ``img_container_format``
 #. ``img_disk_format``
 
@@ -205,13 +201,9 @@
 Tempest where an image file is located and describe its metadata for when it is
 uploaded.
 
-The behavior of these options is a bit convoluted (which will likely be fixed in
-future versions). You first need to specify ``img_dir``, which is the directory
-in which Tempest will look for the image files. First, it will check if the
-filename set for ``img_file`` could be found in ``img_dir``. If it is found then
-the ``img_container_format`` and ``img_disk_format`` options are used to upload
-that image to glance. However, if it is not found, Tempest will look for the
-three uec image file name options as a fallback. If neither is found, the tests
+You first need to specify full path of the image using ``img_file`` option.
+If it is found then the ``img_container_format`` and ``img_disk_format``
+options are used to upload that image to glance. If it's not found, the tests
 requiring an image to upload will fail.
 
 It is worth pointing out that using `cirros`_ is a very good choice for running
diff --git a/releasenotes/notes/Remove-deprecated-image-scenario-options-b573c60e873ab451.yaml b/releasenotes/notes/Remove-deprecated-image-scenario-options-b573c60e873ab451.yaml
new file mode 100644
index 0000000..018d01d
--- /dev/null
+++ b/releasenotes/notes/Remove-deprecated-image-scenario-options-b573c60e873ab451.yaml
@@ -0,0 +1,15 @@
+---
+upgrade:
+  - |
+    The following deprecated image scenario options are removed after a ~4
+    year deprecation period.
+
+    * ``ami_img_file``
+    * ``ari_img_file``
+    * ``aki_img_file``
+
+    Starting Tempest 25.0.0 release, CONF.scenario.img_file need a full path
+    for the image. CONF.scenario.img_dir was deprecated and will be removed
+    in the next release. Till Tempest 25.0.0, old behavior is maintained and
+    keep working but starting Tempest 26.0.0, you need to specify the full path
+    in CONF.scenario.img_file config option.
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 49d9742..aa197ca 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -148,7 +148,7 @@
         self.exec_command('sudo umount %s' % mount_path)
 
     def make_fs(self, dev_name, fs='ext4'):
-        cmd_mkfs = 'sudo /usr/sbin/mke2fs -t %s /dev/%s' % (fs, dev_name)
+        cmd_mkfs = 'sudo mke2fs -t %s /dev/%s' % (fs, dev_name)
         try:
             self.exec_command(cmd_mkfs)
         except tempest.lib.exceptions.SSHExecCommandFailed:
diff --git a/tempest/config.py b/tempest/config.py
index 0015fc3..99a2e6f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -799,7 +799,7 @@
                default="password",
                help="Password used to authenticate to an instance."),
     cfg.StrOpt('ssh_shell_prologue',
-               default="set -eu -o pipefail; PATH=$$PATH:/sbin;",
+               default="set -eu -o pipefail; PATH=$$PATH:/sbin:/usr/sbin;",
                help="Shell fragments to use before executing a command "
                     "when sshing to a guest."),
     cfg.IntOpt('ping_size',
@@ -957,7 +957,10 @@
     cfg.BoolOpt('cluster_active_active',
                 default=False,
                 help='The boolean flag to indicate if active-active mode '
-                     'is used by volume backend.')
+                     'is used by volume backend.'),
+    cfg.ListOpt('supported_crypto_providers',
+                default=['luks'],
+                help='A list of enabled cryptoproviders for volumes')
 ]
 
 
@@ -1035,11 +1038,13 @@
     cfg.StrOpt('img_dir',
                default='/opt/stack/new/devstack/files/images/'
                'cirros-0.3.1-x86_64-uec',
-               help='Directory containing image files',
+               help='Directory containing image files, this has been '
+                    'deprecated - img_file option contains a full path now.',
                deprecated_for_removal=True),
     cfg.StrOpt('img_file', deprecated_name='qcow2_img_file',
-               default='cirros-0.3.1-x86_64-disk.img',
-               help='Image file name'),
+               default='/opt/stack/new/devstack/files/images'
+               '/cirros-0.3.1-x86_64-disk.img',
+               help='Image full path.'),
     cfg.StrOpt('img_disk_format',
                default='qcow2',
                help='Image disk format'),
@@ -1048,18 +1053,6 @@
                help='Image container format'),
     cfg.DictOpt('img_properties', help='Glance image properties. '
                 'Use for custom images which require them'),
-    cfg.StrOpt('ami_img_file',
-               default='cirros-0.3.1-x86_64-blank.img',
-               help='AMI image file name',
-               deprecated_for_removal=True),
-    cfg.StrOpt('ari_img_file',
-               default='cirros-0.3.1-x86_64-initrd',
-               help='ARI image file name',
-               deprecated_for_removal=True),
-    cfg.StrOpt('aki_img_file',
-               default='cirros-0.3.1-x86_64-vmlinuz',
-               help='AKI image file name',
-               deprecated_for_removal=True),
     # TODO(yfried): add support for dhcpcd
     cfg.StrOpt('dhcp_client',
                default='udhcpc',
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index d2fd021..945a268 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -14,6 +14,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import os
 import subprocess
 
 import netaddr
@@ -454,33 +455,32 @@
         return image['id']
 
     def glance_image_create(self):
-        img_path = CONF.scenario.img_dir + "/" + CONF.scenario.img_file
-        aki_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.aki_img_file
-        ari_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ari_img_file
-        ami_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ami_img_file
+        img_path = CONF.scenario.img_file
+        if not os.path.exists(img_path):
+            # TODO(kopecmartin): replace LOG.warning for rasing
+            # InvalidConfiguration exception after tempest 25.0.0 is
+            # released - there will be one release which accepts both
+            # behaviors in order to avoid many failures across CIs and etc.
+            LOG.warning(
+                'Starting Tempest 25.0.0 release, CONF.scenario.img_file need '
+                'a full path for the image. CONF.scenario.img_dir was '
+                'deprecated and will be removed in the next release. Till '
+                'Tempest 25.0.0, old behavior is maintained and keep working '
+                'but starting Tempest 26.0.0, you need to specify the full '
+                'path in CONF.scenario.img_file config option.')
+            img_path = os.path.join(CONF.scenario.img_dir, img_path)
         img_container_format = CONF.scenario.img_container_format
         img_disk_format = CONF.scenario.img_disk_format
         img_properties = CONF.scenario.img_properties
         LOG.debug("paths: img: %s, container_format: %s, disk_format: %s, "
-                  "properties: %s, ami: %s, ari: %s, aki: %s",
+                  "properties: %s",
                   img_path, img_container_format, img_disk_format,
-                  img_properties, ami_img_path, ari_img_path, aki_img_path)
-        try:
-            image = self._image_create('scenario-img',
-                                       img_container_format,
-                                       img_path,
-                                       disk_format=img_disk_format,
-                                       properties=img_properties)
-        except IOError:
-            LOG.warning(
-                "A(n) %s image was not found. Retrying with uec image.",
-                img_disk_format)
-            kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
-            ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
-            properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}
-            image = self._image_create('scenario-ami', 'ami',
-                                       path=ami_img_path,
-                                       properties=properties)
+                  img_properties)
+        image = self._image_create('scenario-img',
+                                   img_container_format,
+                                   img_path,
+                                   disk_format=img_disk_format,
+                                   properties=img_properties)
         LOG.debug("image:%s", image)
 
         return image
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index 008d1ae..8571506 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -18,6 +18,8 @@
 from tempest.lib import decorators
 from tempest.scenario import manager
 
+import testtools
+
 CONF = config.CONF
 
 
@@ -55,6 +57,9 @@
 
     @decorators.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
     @decorators.attr(type='slow')
+    @testtools.skipUnless(
+        'luks' in CONF.volume_feature_enabled.supported_crypto_providers,
+        'Cryptoprovider is not supported.')
     @utils.services('compute', 'volume', 'image')
     def test_encrypted_cinder_volumes_luks(self):
         server = self.launch_instance()
@@ -64,6 +69,9 @@
 
     @decorators.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
     @decorators.attr(type='slow')
+    @testtools.skipUnless(
+        'plain' in CONF.volume_feature_enabled.supported_crypto_providers,
+        'Cryptoprovider is not supported.')
     @utils.services('compute', 'volume', 'image')
     def test_encrypted_cinder_volumes_cryptsetup(self):
         server = self.launch_instance()
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 1f0080f..644a018 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -88,7 +88,7 @@
     # the information using gnu/linux tools.
 
     def _assert_exec_called_with(self, cmd):
-        cmd = "set -eu -o pipefail; PATH=$PATH:/sbin; " + cmd
+        cmd = "set -eu -o pipefail; PATH=$PATH:/sbin:/usr/sbin; " + cmd
         self.ssh_mock.mock.exec_command.assert_called_with(cmd)
 
     def test_get_disks(self):