Add image client build timeout config option
This patch Ibc4307b406b71db258975da90a39c1f51ad27e12 changed
the RestClient so that it does not use the
CONF.compute.build_timeout variable anymore.
For this reason, there is no way to specify a timeout for the image
client, which inherits the hardcoded 60 seconds timeout.
This patch introduces a config option for this. For consistency,
a config option was added for build interval as well.
Change-Id: I0ac5ead60c4dc5a0c04feee513ae299ca14bd38e
Partial-bug: #1394519
Closes-bug: #1407943
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 61c840b..2e1d6f3 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -278,8 +278,8 @@
#build_interval = 1
# Timeout in seconds to wait for an instance to build. Other services
-# that do not define build_timeout will inherit this value, for
-# example the image service. (integer value)
+# that do not define build_timeout will inherit this value. (integer
+# value)
#build_timeout = 300
# Should the tests ssh to instances? (boolean value)
@@ -620,6 +620,14 @@
# http accessible image (string value)
#http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+# Timeout in seconds to wait for an image to become available.
+# (integer value)
+#build_timeout = 300
+
+# Time in seconds between image operation status checks. (integer
+# value)
+#build_interval = 1
+
[image-feature-enabled]
diff --git a/tempest/config.py b/tempest/config.py
index 54a4dd1..1c0dabb 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -187,7 +187,7 @@
default=300,
help="Timeout in seconds to wait for an instance to build. "
"Other services that do not define build_timeout will "
- "inherit this value, for example the image service."),
+ "inherit this value."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
@@ -371,7 +371,15 @@
cfg.StrOpt('http_image',
default='http://download.cirros-cloud.net/0.3.1/'
'cirros-0.3.1-x86_64-uec.tar.gz',
- help='http accessible image')
+ help='http accessible image'),
+ cfg.IntOpt('build_timeout',
+ default=300,
+ help="Timeout in seconds to wait for an image to "
+ "become available."),
+ cfg.IntOpt('build_interval',
+ default=1,
+ help="Time in seconds between image operation status "
+ "checks.")
]
image_feature_group = cfg.OptGroup(name='image-feature-enabled',
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 013784c..021f43f 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -39,7 +39,9 @@
auth_provider,
CONF.image.catalog_type,
CONF.image.region or CONF.identity.region,
- endpoint_type=CONF.image.endpoint_type)
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _image_meta_from_headers(self, headers):
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 2b3cb0e..141cf6c 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -33,7 +33,9 @@
auth_provider,
CONF.image.catalog_type,
CONF.image.region or CONF.identity.region,
- endpoint_type=CONF.image.endpoint_type)
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _get_http(self):