Merge "Fix http_image uploading to glance"
This commit is contained in:
commit
947946419c
@ -139,7 +139,7 @@ def read_deployer_input(deployer_input_file, conf):
|
||||
conf.set(section, key, value, priority=True)
|
||||
|
||||
|
||||
def set_options(conf, deployer_input, non_admin, overrides=[],
|
||||
def set_options(conf, deployer_input, non_admin, image_path, overrides=[],
|
||||
test_accounts=None, cloud_creds=None,
|
||||
no_default_deployer=False):
|
||||
"""Set options in conf provided by different source.
|
||||
@ -155,6 +155,8 @@ def set_options(conf, deployer_input, non_admin, overrides=[],
|
||||
:param deployer_input: Path to the deployer inut file
|
||||
:type deployer_input: string
|
||||
:type non_admin: boolean
|
||||
:param image_path: An image to be uploaded to glance
|
||||
:type image_path: string
|
||||
:param overrides: list of tuples: [(section, key, value)]
|
||||
:type overrides: list
|
||||
:param test_accounts: Path to the accounts.yaml file
|
||||
@ -163,6 +165,9 @@ def set_options(conf, deployer_input, non_admin, overrides=[],
|
||||
:type cloud_creds: dict
|
||||
"""
|
||||
load_basic_defaults(conf)
|
||||
# image.image_path is a python-tempestconf option which defines which
|
||||
# image will be uploaded to glance
|
||||
conf.set('image', 'image_path', image_path)
|
||||
|
||||
if deployer_input and os.path.isfile(deployer_input):
|
||||
LOG.info("Reading deployer input from file {}".format(
|
||||
@ -387,6 +392,7 @@ def config_tempest(**kwargs):
|
||||
conf = TempestConf(write_credentials=write_credentials)
|
||||
set_options(conf, kwargs.get('deployer_input'),
|
||||
kwargs.get('non_admin', False),
|
||||
kwargs.get('image_path', C.DEFAULT_IMAGE),
|
||||
kwargs.get('overrides', []), kwargs.get('test_accounts'),
|
||||
kwargs.get('cloud_creds'))
|
||||
|
||||
@ -401,7 +407,6 @@ def config_tempest(**kwargs):
|
||||
flavors.create_tempest_flavors()
|
||||
|
||||
image = services.get_service('image')
|
||||
conf.set('image', 'http_image', kwargs.get('image_path', C.DEFAULT_IMAGE))
|
||||
image.set_image_preferences(kwargs.get('image_disk_format',
|
||||
C.DEFAULT_IMAGE_FORMAT),
|
||||
kwargs.get('non_admin', False))
|
||||
|
@ -45,8 +45,16 @@ class ImageService(VersionedService):
|
||||
# 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',
|
||||
'http_image').rsplit('/')[-1]:
|
||||
'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.
|
||||
# image.http_image and image.image_path can be 2 different images.
|
||||
# If image.http_image wasn't set as an override, it will be set to
|
||||
# image.image_path
|
||||
conf.set('image', 'http_image', conf.get_defaulted('image',
|
||||
'image_path'))
|
||||
|
||||
def set_versions(self):
|
||||
super(ImageService, self).set_versions(top_level=False)
|
||||
@ -60,7 +68,7 @@ class ImageService(VersionedService):
|
||||
:type conf: TempestConf object
|
||||
"""
|
||||
img_dir = os.path.join(conf.get("scenario", "img_dir"))
|
||||
image_path = conf.get_defaulted('image', 'http_image')
|
||||
image_path = conf.get_defaulted('image', 'image_path')
|
||||
img_path = os.path.join(img_dir,
|
||||
os.path.basename(image_path))
|
||||
name = image_path[image_path.rfind('/') + 1:]
|
||||
|
@ -43,7 +43,8 @@ class TestImageService(BaseServiceTest):
|
||||
self.dir = "/img/"
|
||||
self.conf = TempestConf()
|
||||
self.conf.set("scenario", "img_dir", self.dir)
|
||||
self.conf.set("image", "http_image", "my_image.qcow2")
|
||||
self.conf.set("image", "image_path", "my_image.qcow2")
|
||||
self.conf.set("image", "http_image", "http_image.qcow2")
|
||||
|
||||
@mock.patch('config_tempest.services.image.ImageService'
|
||||
'.find_or_upload_image')
|
||||
|
Loading…
Reference in New Issue
Block a user