summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-extended
diff options
context:
space:
mode:
authorVu Tran <vu.tran@windriver.com>2014-05-23 11:43:40 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-05-26 11:30:08 -0400
commit9d9f9d4a538a1d4d5d8c951db4be708d005f54b7 (patch)
treec1883ed7644c49caa242531091366a3dff2fb458 /meta-openstack/recipes-extended
parentd76df162be16d17a5318483602b2c59d7fef66ed (diff)
downloadmeta-cloud-services-9d9f9d4a538a1d4d5d8c951db4be708d005f54b7.tar.gz
tempest image client not specify version
Currently glance keystone endpoints URLs include "v2/" at the end (e.g. http://<glance server ip>:9292:v2/). This means glance should only be talked to using v2. For tempest image testcases, image_client.py gets URLs from keystones and appends additional version into these URL strings (e.g. htt://<glance server ip>:9292:v2/v2/images) which causes glance not to understand the command and return error: NotFound: Object not found Details: 404 Not Found The resource could not be found. In our case, we use the "v2" from URLs. We also disable v1 image testcases as it's not possible to test v1 with current glance endpoind URLs. Signed-off-by: Vu Tran <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-extended')
-rw-r--r--meta-openstack/recipes-extended/tempest/tempest/image-client-not-specify-version.patch107
-rw-r--r--meta-openstack/recipes-extended/tempest/tempest/tempest.conf2
-rw-r--r--meta-openstack/recipes-extended/tempest/tempest_git.bb1
3 files changed, 109 insertions, 1 deletions
diff --git a/meta-openstack/recipes-extended/tempest/tempest/image-client-not-specify-version.patch b/meta-openstack/recipes-extended/tempest/tempest/image-client-not-specify-version.patch
new file mode 100644
index 0000000..039a694
--- /dev/null
+++ b/meta-openstack/recipes-extended/tempest/tempest/image-client-not-specify-version.patch
@@ -0,0 +1,107 @@
1image client not specify version
2
3Currenlty glance keystone endpoints URLs include
4"v2/" at the end (e.g. http://<glance server ip>:9292:v2/).
5This means glance should only be talked to using v2.
6
7For tempest image testcases, image_client.py gets URLs
8from keystones and appends additional version into
9these URL strings (e.g. htt://<glance server ip>:9292:v2/v2/images)
10which causes glance not to understand the command and return error:
11
12NotFound: Object not found
13Details: 404 Not Found
14The resource could not be found.
15
16In our case, we use the "v2" from URLs.
17
18Signed-off-by: Vu Tran <vu.tran@windriver.com>
19
20diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
21index ab0cb00..b5568b9 100644
22--- a/tempest/api/image/base.py
23+++ b/tempest/api/image/base.py
24@@ -92,6 +92,10 @@ class BaseV2ImageTest(BaseImageTest):
25 def setUpClass(cls):
26 super(BaseV2ImageTest, cls).setUpClass()
27 cls.client = cls.os.image_client_v2
28+ # Currently Glance endpoint url from keystone
29+ # does contain "v2" so in test we do not pass
30+ # in version.
31+ cls.client.desired_version = ''
32 if not cls.config.image_feature_enabled.api_v2:
33 msg = "Glance API v2 not supported"
34 raise cls.skipException(msg)
35diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
36index f0531ec..febe0c2 100644
37--- a/tempest/services/image/v2/json/image_client.py
38+++ b/tempest/services/image/v2/json/image_client.py
39@@ -32,6 +32,7 @@ class ImageClientV2JSON(rest_client.RestClient):
40 auth_url, tenant_name)
41 self.service = self.config.images.catalog_type
42 self.http = self._get_http()
43+ self.desired_version = 'v2/'
44
45 def _get_http(self):
46 token, endpoint = self.keystone_auth(self.user, self.password,
47@@ -42,13 +43,13 @@ class ImageClientV2JSON(rest_client.RestClient):
48 insecure=dscv)
49
50 def get_images_schema(self):
51- url = 'v2/schemas/images'
52+ url = self.desired_version + 'schemas/images'
53 resp, body = self.get(url)
54 body = json.loads(body)
55 return resp, body
56
57 def get_image_schema(self):
58- url = 'v2/schemas/image'
59+ url = self.desired_version + 'schemas/image'
60 resp, body = self.get(url)
61 body = json.loads(body)
62 return resp, body
63@@ -81,16 +82,16 @@ class ImageClientV2JSON(rest_client.RestClient):
64 data = json.dumps(params)
65 self._validate_schema(data)
66
67- resp, body = self.post('v2/images', data, self.headers)
68+ resp, body = self.post(self.desired_version + 'images', data, self.headers)
69 body = json.loads(body)
70 return resp, body
71
72 def delete_image(self, image_id):
73- url = 'v2/images/%s' % image_id
74+ url = self.desired_version + 'images/%s' % image_id
75 self.delete(url)
76
77 def image_list(self, params=None):
78- url = 'v2/images'
79+ url = self.desired_version + 'images'
80
81 if params:
82 url += '?%s' % urllib.urlencode(params)
83@@ -101,7 +102,7 @@ class ImageClientV2JSON(rest_client.RestClient):
84 return resp, body['images']
85
86 def get_image_metadata(self, image_id):
87- url = 'v2/images/%s' % image_id
88+ url = self.desired_version + 'images/%s' % image_id
89 resp, body = self.get(url)
90 body = json.loads(body)
91 return resp, body
92@@ -114,13 +115,13 @@ class ImageClientV2JSON(rest_client.RestClient):
93 return False
94
95 def store_image(self, image_id, data):
96- url = 'v2/images/%s/file' % image_id
97+ url = self.desired_version + 'images/%s/file' % image_id
98 headers = {'Content-Type': 'application/octet-stream'}
99 resp, body = self.http.raw_request('PUT', url, headers=headers,
100 body=data)
101 return resp, body
102
103 def get_image_file(self, image_id):
104- url = 'v2/images/%s/file' % image_id
105+ url = self.desired_version + 'images/%s/file' % image_id
106 resp, body = self.get(url)
107 return resp, body
diff --git a/meta-openstack/recipes-extended/tempest/tempest/tempest.conf b/meta-openstack/recipes-extended/tempest/tempest/tempest.conf
index e730983..7a5bf3b 100644
--- a/meta-openstack/recipes-extended/tempest/tempest/tempest.conf
+++ b/meta-openstack/recipes-extended/tempest/tempest/tempest.conf
@@ -202,7 +202,7 @@ http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.
202 202
203[image-feature-enabled] 203[image-feature-enabled]
204# Is the image api_v1 enabled 204# Is the image api_v1 enabled
205api_v1 = True 205api_v1 = False
206# Is the image api_v2 enabled 206# Is the image api_v2 enabled
207api_v2 = True 207api_v2 = True
208 208
diff --git a/meta-openstack/recipes-extended/tempest/tempest_git.bb b/meta-openstack/recipes-extended/tempest/tempest_git.bb
index 10b772b..899d7e5 100644
--- a/meta-openstack/recipes-extended/tempest/tempest_git.bb
+++ b/meta-openstack/recipes-extended/tempest/tempest_git.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master \
13 file://tempest.conf \ 13 file://tempest.conf \
14 file://logging.conf \ 14 file://logging.conf \
15 file://0001-Stop-auto-detecting-glance-API-versions.patch \ 15 file://0001-Stop-auto-detecting-glance-API-versions.patch \
16 file://image-client-not-specify-version.patch \
16" 17"
17 18
18SRCREV="50af5d5ecc7d21d5e0d1a36fa564ef4850cf94ff" 19SRCREV="50af5d5ecc7d21d5e0d1a36fa564ef4850cf94ff"