Add multistore image option

This is an attempt to populate tempestconf with
multistore feature enabled if and only if multiple
stores are available.
In Rocky and Stein, Glance has added the ability to
configure multiple stores as an EXPERIMENTAL feature.
This feature is fully supported from the Train cycle.

Please refer [1] for more information
[1] https://specs.openstack.org/openstack/cinder-specs/specs/ussuri/support-glance-multiple-backend.html

Signed-off-by: Soniya Vyas <svyas@redhat.com>
Change-Id: I45f9dce14b60e9385600c57ee56b50aba3a4476f
This commit is contained in:
Soniya Vyas 2021-12-02 18:43:49 +05:30
parent 2bf7bf6a84
commit 5439997d4b
1 changed files with 13 additions and 0 deletions

View File

@ -56,12 +56,17 @@ class ImageService(VersionedService):
self.convert = convert
def set_default_tempest_options(self, conf):
# set 'image-feature-enabled' only if multiple stores available
num_stores = self._get_number_of_stores()
if num_stores >= 1:
conf.set('image-feature-enabled', 'import_image', 'True')
# When cirros is the image, set validation.image_ssh_user to cirros.
# The option is heavily used in CI and it's also usefull for refstack,
# because we don't have to specify overrides.
if 'cirros' in conf.get_defaulted('image',
'image_path').rsplit('/')[-1]:
conf.set('validation', 'image_ssh_user', 'cirros')
# image.http_image is a tempest option which defines 'http accessible
# image', it can be in a compressed format so it can't be mistaken
# for an image which will be uploaded to the glance.
@ -77,6 +82,14 @@ class ImageService(VersionedService):
# default value
conf.set('image', 'http_image', C.DEFAULT_IMAGE)
def _get_number_of_stores(self):
try:
stores = self.client.get_stores()['stores']
return len(stores)
except exceptions.Forbidden:
C.LOG.info('Can not retrieve stores, user are not allowed')
return 1
def get_supported_versions(self):
return ['v1', 'v2']