Kurt Taylor | 6a6f5be | 2013-04-02 18:53:47 -0400 | [diff] [blame] | 1 | # Copyright 2013 IBM Corp. |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Jordan Pittier | 9a573d9 | 2016-04-29 17:04:39 +0200 | [diff] [blame] | 16 | import functools |
| 17 | |
Matthew Treinish | 2190551 | 2015-07-13 10:33:35 -0400 | [diff] [blame] | 18 | from oslo_serialization import jsonutils as json |
Matthew Treinish | 8912814 | 2015-04-23 10:44:30 -0400 | [diff] [blame] | 19 | from six.moves.urllib import parse as urllib |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 20 | |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 21 | from tempest.lib.common import rest_client |
Andrea Frittoli (andreaf) | db9672e | 2016-02-23 14:07:24 -0500 | [diff] [blame] | 22 | from tempest.lib import exceptions as lib_exc |
Matthew Treinish | 684d899 | 2014-01-30 16:27:40 +0000 | [diff] [blame] | 23 | |
Jordan Pittier | 9a573d9 | 2016-04-29 17:04:39 +0200 | [diff] [blame] | 24 | CHUNKSIZE = 1024 * 64 # 64kB |
| 25 | |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 26 | |
Yaroslav Lobankov | 2fea405 | 2016-04-19 15:05:57 +0300 | [diff] [blame] | 27 | class ImagesClient(rest_client.RestClient): |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 28 | api_version = "v2" |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 29 | |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 30 | def update_image(self, image_id, patch): |
Ken'ichi Ohmichi | 25b3016 | 2015-11-30 11:27:13 +0000 | [diff] [blame] | 31 | """Update an image. |
| 32 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 33 | For a full list of available parameters, please refer to the official |
| 34 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 35 | https://docs.openstack.org/api-ref/image/v2/#update-image |
Ken'ichi Ohmichi | 25b3016 | 2015-11-30 11:27:13 +0000 | [diff] [blame] | 36 | """ |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 37 | data = json.dumps(patch) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 38 | headers = {"Content-Type": "application/openstack-images-v2.0" |
| 39 | "-json-patch"} |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 40 | resp, body = self.patch('images/%s' % image_id, data, headers) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 41 | self.expected_success(200, resp.status) |
ghanshyam | 08a73f9 | 2015-08-31 17:32:49 +0900 | [diff] [blame] | 42 | body = json.loads(body) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 43 | return rest_client.ResponseBody(resp, body) |
Sergey Nikitin | c6b2ee8 | 2014-02-03 17:13:50 +0400 | [diff] [blame] | 44 | |
Ken'ichi Ohmichi | 25b3016 | 2015-11-30 11:27:13 +0000 | [diff] [blame] | 45 | def create_image(self, **kwargs): |
| 46 | """Create an image. |
Matthew Treinish | ce3ef92 | 2013-03-11 14:02:46 -0400 | [diff] [blame] | 47 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 48 | For a full list of available parameters, please refer to the official |
| 49 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 50 | https://docs.openstack.org/api-ref/image/v2/#create-image |
Ken'ichi Ohmichi | 25b3016 | 2015-11-30 11:27:13 +0000 | [diff] [blame] | 51 | """ |
| 52 | data = json.dumps(kwargs) |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 53 | resp, body = self.post('images', data) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 54 | self.expected_success(201, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 55 | body = json.loads(body) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 56 | return rest_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 57 | |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 58 | def deactivate_image(self, image_id): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 59 | """Deactivate image. |
| 60 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 61 | For a full list of available parameters, please refer to the official |
| 62 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 63 | https://docs.openstack.org/api-ref/image/v2/#deactivate-image |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 64 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 65 | url = 'images/%s/actions/deactivate' % image_id |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 66 | resp, body = self.post(url, None) |
| 67 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 68 | return rest_client.ResponseBody(resp, body) |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 69 | |
| 70 | def reactivate_image(self, image_id): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 71 | """Reactivate image. |
| 72 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 73 | For a full list of available parameters, please refer to the official |
| 74 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 75 | https://docs.openstack.org/api-ref/image/v2/#reactivate-image |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 76 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 77 | url = 'images/%s/actions/reactivate' % image_id |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 78 | resp, body = self.post(url, None) |
| 79 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 80 | return rest_client.ResponseBody(resp, body) |
bkopilov | 81aaae7 | 2015-05-15 23:46:25 +0300 | [diff] [blame] | 81 | |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 82 | def delete_image(self, image_id): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 83 | """Delete image. |
| 84 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 85 | For a full list of available parameters, please refer to the official |
| 86 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 87 | https://docs.openstack.org/api-ref/image/v2/#delete-image |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 88 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 89 | url = 'images/%s' % image_id |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 90 | resp, _ = self.delete(url) |
| 91 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 92 | return rest_client.ResponseBody(resp) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 93 | |
Ken'ichi Ohmichi | e3acc12 | 2015-05-22 00:32:54 +0000 | [diff] [blame] | 94 | def list_images(self, params=None): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 95 | """List images. |
| 96 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 97 | For a full list of available parameters, please refer to the official |
| 98 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 99 | https://docs.openstack.org/api-ref/image/v2/#list-images |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 100 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 101 | url = 'images' |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 102 | |
| 103 | if params: |
| 104 | url += '?%s' % urllib.urlencode(params) |
| 105 | |
| 106 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 107 | self.expected_success(200, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 108 | body = json.loads(body) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 109 | return rest_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 110 | |
Ken'ichi Ohmichi | 5d41076 | 2015-05-22 01:10:03 +0000 | [diff] [blame] | 111 | def show_image(self, image_id): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 112 | """Show image details. |
| 113 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 114 | For a full list of available parameters, please refer to the official |
| 115 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 116 | https://docs.openstack.org/api-ref/image/v2/#show-image |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 117 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 118 | url = 'images/%s' % image_id |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 119 | resp, body = self.get(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 120 | self.expected_success(200, resp.status) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 121 | body = json.loads(body) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 122 | return rest_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 123 | |
| 124 | def is_resource_deleted(self, id): |
| 125 | try: |
Ken'ichi Ohmichi | 5d41076 | 2015-05-22 01:10:03 +0000 | [diff] [blame] | 126 | self.show_image(id) |
Masayuki Igawa | bfa0760 | 2015-01-20 18:47:17 +0900 | [diff] [blame] | 127 | except lib_exc.NotFound: |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 128 | return True |
| 129 | return False |
| 130 | |
Abhishek Kekane | 7cff130 | 2020-07-16 10:30:13 +0000 | [diff] [blame] | 131 | def is_resource_active(self, id): |
| 132 | try: |
| 133 | image = self.show_image(id) |
| 134 | if image['status'] != 'active': |
| 135 | return False |
| 136 | except lib_exc.NotFound: |
| 137 | return False |
| 138 | return True |
| 139 | |
Matt Riedemann | d2b9651 | 2014-10-13 10:18:16 -0700 | [diff] [blame] | 140 | @property |
| 141 | def resource_type(self): |
| 142 | """Returns the primary type of resource this client works with.""" |
| 143 | return 'image' |
| 144 | |
Ken'ichi Ohmichi | 66494e9 | 2015-06-08 04:28:10 +0000 | [diff] [blame] | 145 | def store_image_file(self, image_id, data): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 146 | """Upload binary image data. |
| 147 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 148 | For a full list of available parameters, please refer to the official |
| 149 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 150 | https://docs.openstack.org/api-ref/image/v2/#upload-binary-image-data |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 151 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 152 | url = 'images/%s/file' % image_id |
Jordan Pittier | 9a573d9 | 2016-04-29 17:04:39 +0200 | [diff] [blame] | 153 | |
| 154 | # We are going to do chunked transfert, so split the input data |
| 155 | # info fixed-sized chunks. |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 156 | headers = {'Content-Type': 'application/octet-stream'} |
Jordan Pittier | 9a573d9 | 2016-04-29 17:04:39 +0200 | [diff] [blame] | 157 | data = iter(functools.partial(data.read, CHUNKSIZE), b'') |
| 158 | |
| 159 | resp, body = self.request('PUT', url, headers=headers, |
| 160 | body=data, chunked=True) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 161 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 162 | return rest_client.ResponseBody(resp, body) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 163 | |
Abhishek Kekane | 7cff130 | 2020-07-16 10:30:13 +0000 | [diff] [blame] | 164 | def stage_image_file(self, image_id, data): |
| 165 | """Upload binary image data to staging area. |
| 166 | |
| 167 | For a full list of available parameters, please refer to the official |
| 168 | API reference (stage API: |
| 169 | https://docs.openstack.org/api-ref/image/v2/#interoperable-image-import |
| 170 | """ |
| 171 | url = 'images/%s/stage' % image_id |
| 172 | |
| 173 | # We are going to do chunked transfer, so split the input data |
| 174 | # info fixed-sized chunks. |
| 175 | headers = {'Content-Type': 'application/octet-stream'} |
| 176 | data = iter(functools.partial(data.read, CHUNKSIZE), b'') |
| 177 | |
| 178 | resp, body = self.request('PUT', url, headers=headers, |
| 179 | body=data, chunked=True) |
| 180 | self.expected_success(204, resp.status) |
| 181 | return rest_client.ResponseBody(resp, body) |
| 182 | |
| 183 | def info_import(self): |
| 184 | """Return information about server-supported import methods.""" |
| 185 | url = 'info/import' |
| 186 | resp, body = self.get(url) |
| 187 | |
| 188 | self.expected_success(200, resp.status) |
| 189 | body = json.loads(body) |
| 190 | return rest_client.ResponseBody(resp, body) |
| 191 | |
| 192 | def info_stores(self): |
| 193 | """Return information about server-supported stores.""" |
| 194 | url = 'info/stores' |
| 195 | resp, body = self.get(url) |
| 196 | body = json.loads(body) |
| 197 | return rest_client.ResponseBody(resp, body) |
| 198 | |
| 199 | def image_import(self, image_id, method='glance-direct', |
| 200 | all_stores_must_succeed=None, all_stores=True, |
Ghanshyam Mann | 1425ecd | 2020-07-22 21:01:26 -0500 | [diff] [blame] | 201 | stores=None, image_uri=None): |
Abhishek Kekane | 7cff130 | 2020-07-16 10:30:13 +0000 | [diff] [blame] | 202 | """Import data from staging area to glance store. |
| 203 | |
| 204 | For a full list of available parameters, please refer to the official |
| 205 | API reference (stage API: |
| 206 | https://docs.openstack.org/api-ref/image/v2/#interoperable-image-import |
| 207 | |
| 208 | :param method: The import method (i.e. glance-direct) to use |
| 209 | :param all_stores_must_succeed: Boolean indicating if all store imports |
| 210 | must succeed for the import to be |
| 211 | considered successful. Must be None if |
| 212 | server does not support multistore. |
| 213 | :param all_stores: Boolean indicating if image should be imported to |
| 214 | all available stores (incompatible with stores) |
| 215 | :param stores: A list of destination store names for the import. Must |
| 216 | be None if server does not support multistore. |
Ghanshyam Mann | 1425ecd | 2020-07-22 21:01:26 -0500 | [diff] [blame] | 217 | :param image_uri: A URL to be used with the web-download method |
Abhishek Kekane | 7cff130 | 2020-07-16 10:30:13 +0000 | [diff] [blame] | 218 | """ |
| 219 | url = 'images/%s/import' % image_id |
| 220 | data = { |
| 221 | "method": { |
| 222 | "name": method |
| 223 | }, |
| 224 | } |
| 225 | if stores is not None: |
| 226 | data["stores"] = stores |
| 227 | else: |
| 228 | data["all_stores"] = all_stores |
| 229 | |
| 230 | if all_stores_must_succeed is not None: |
| 231 | data['all_stores_must_succeed'] = all_stores_must_succeed |
Ghanshyam Mann | 1425ecd | 2020-07-22 21:01:26 -0500 | [diff] [blame] | 232 | if image_uri: |
| 233 | data['method']['uri'] = image_uri |
Abhishek Kekane | 7cff130 | 2020-07-16 10:30:13 +0000 | [diff] [blame] | 234 | data = json.dumps(data) |
| 235 | headers = {'Content-Type': 'application/json'} |
| 236 | resp, _ = self.post(url, data, headers=headers) |
| 237 | |
| 238 | self.expected_success(202, resp.status) |
| 239 | return rest_client.ResponseBody(resp) |
| 240 | |
Ken'ichi Ohmichi | 6bd6f20 | 2015-11-20 05:29:38 +0000 | [diff] [blame] | 241 | def show_image_file(self, image_id): |
Anthony Washington | 4dcd002 | 2016-06-30 18:24:46 +0000 | [diff] [blame] | 242 | """Download binary image data. |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 243 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 244 | For a full list of available parameters, please refer to the official |
| 245 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 246 | https://docs.openstack.org/api-ref/image/v2/#download-binary-image-data |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 247 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 248 | url = 'images/%s/file' % image_id |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 249 | resp, body = self.get(url) |
zhufl | fd5a14b | 2018-03-16 15:24:17 +0800 | [diff] [blame] | 250 | self.expected_success([200, 204, 206], resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 251 | return rest_client.ResponseBodyData(resp, body) |
Anju Tiwari | c495298 | 2013-10-20 07:10:02 +0530 | [diff] [blame] | 252 | |
| 253 | def add_image_tag(self, image_id, tag): |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 254 | """Add an image tag. |
| 255 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 256 | For a full list of available parameters, please refer to the official |
| 257 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 258 | https://docs.openstack.org/api-ref/image/v2/#add-image-tag |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 259 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 260 | url = 'images/%s/tags/%s' % (image_id, tag) |
Valeriy Ponomaryov | 88686d8 | 2014-02-16 12:24:51 +0200 | [diff] [blame] | 261 | resp, body = self.put(url, body=None) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 262 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 263 | return rest_client.ResponseBody(resp, body) |
Anju Tiwari | c495298 | 2013-10-20 07:10:02 +0530 | [diff] [blame] | 264 | |
| 265 | def delete_image_tag(self, image_id, tag): |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 266 | """Delete an image tag. |
| 267 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 268 | For a full list of available parameters, please refer to the official |
| 269 | API reference: |
Andreas Jaeger | bf30ae7 | 2019-07-22 19:22:57 +0200 | [diff] [blame] | 270 | https://docs.openstack.org/api-ref/image/v2/#delete-image-tag |
bkopilov | cb1c629 | 2016-06-30 09:20:34 +0300 | [diff] [blame] | 271 | """ |
Andrea Frittoli | cf40a86 | 2016-06-07 14:45:32 +0900 | [diff] [blame] | 272 | url = 'images/%s/tags/%s' % (image_id, tag) |
Anju Tiwari | c495298 | 2013-10-20 07:10:02 +0530 | [diff] [blame] | 273 | resp, _ = self.delete(url) |
David Kranz | 9c3b3b6 | 2014-06-19 16:05:53 -0400 | [diff] [blame] | 274 | self.expected_success(204, resp.status) |
Ken'ichi Ohmichi | e76510d | 2016-03-02 10:33:48 -0800 | [diff] [blame] | 275 | return rest_client.ResponseBody(resp) |