Merge "Stop auto-detecting glance API versions"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index e6442c7..87bf758 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -198,12 +198,15 @@
# catalog, the first found one is used.
#region = RegionOne
-# The version of the OpenStack Images API to use
-api_version = 1
-
# HTTP image to use for glance http image testing
http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+[image-feature-enabled]
+# Is the image api_v1 enabled
+api_v1 = True
+# Is the image api_v2 enabled
+api_v2 = True
+
[network]
# This section contains configuration options used when executing tests
# against the OpenStack Network API.
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 4f54a15..ab0cb00 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -74,17 +74,6 @@
cls.created_images.append(image['id'])
return resp, image
- @classmethod
- def _check_version(cls, version):
- __, versions = cls.client.get_versions()
- if version == 'v2.0':
- if 'v2.0' in versions:
- return True
- elif version == 'v1.0':
- if 'v1.1' in versions or 'v1.0' in versions:
- return True
- return False
-
class BaseV1ImageTest(BaseImageTest):
@@ -92,7 +81,7 @@
def setUpClass(cls):
super(BaseV1ImageTest, cls).setUpClass()
cls.client = cls.os.image_client
- if not cls._check_version('v1.0'):
+ if not cls.config.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
raise cls.skipException(msg)
@@ -103,6 +92,6 @@
def setUpClass(cls):
super(BaseV2ImageTest, cls).setUpClass()
cls.client = cls.os.image_client_v2
- if not cls._check_version('v2.0'):
+ if not cls.config.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
raise cls.skipException(msg)
diff --git a/tempest/config.py b/tempest/config.py
index 4bae9e4..effa5a1 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -252,9 +252,6 @@
title="Image Service Options")
ImageGroup = [
- cfg.StrOpt('api_version',
- default='1',
- help="Version of the API"),
cfg.StrOpt('catalog_type',
default='image',
help='Catalog type of the Image service.'),
@@ -270,6 +267,17 @@
help='http accessible image')
]
+image_feature_group = cfg.OptGroup(name='image-feature-enabled',
+ title='Enabled image service features')
+
+ImageFeaturesGroup = [
+ cfg.BoolOpt('api_v2',
+ default=True,
+ help="Is the v2 image API enabled"),
+ cfg.BoolOpt('api_v1',
+ default=True,
+ help="Is the v1 image API enabled"),
+]
network_group = cfg.OptGroup(name='network',
title='Network Service Options')
@@ -638,6 +646,7 @@
ComputeFeaturesGroup)
register_opt_group(cfg.CONF, identity_group, IdentityGroup)
register_opt_group(cfg.CONF, image_group, ImageGroup)
+ register_opt_group(cfg.CONF, image_feature_group, ImageFeaturesGroup)
register_opt_group(cfg.CONF, network_group, NetworkGroup)
register_opt_group(cfg.CONF, volume_group, VolumeGroup)
register_opt_group(cfg.CONF, volume_feature_group,
@@ -658,6 +667,7 @@
self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
self.identity = cfg.CONF.identity
self.images = cfg.CONF.image
+ self.image_feature_enabled = cfg.CONF['image-feature-enabled']
self.network = cfg.CONF.network
self.volume = cfg.CONF.volume
self.volume_feature_enabled = cfg.CONF['volume-feature-enabled']