Remove deprecated scenario image options

Let's remove deprecated scenario image options which have been
deprecated for more than 4 years.

From now on CONF.scenario.img_file will 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.

Change-Id: I96d26ad3889f55d867fdea016953cce522a6fbdf
Related-Bug: #1393881
This commit is contained in:
Martin Kopec 2020-03-03 12:39:12 +00:00
parent c5e33135a9
commit 02af6a44cc
4 changed files with 45 additions and 48 deletions

View File

@ -193,10 +193,6 @@ those tests will be skipped.
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 @@ of scenario tests which are uploading an image. These options are used to tell
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

View File

@ -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.

View File

@ -1068,11 +1068,13 @@ ScenarioGroup = [
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'),
@ -1081,18 +1083,6 @@ ScenarioGroup = [
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',

View File

@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import subprocess
import netaddr
@ -531,33 +532,32 @@ class ScenarioTest(tempest.test.BaseTestCase):
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