diff options
| author | Zuul <zuul@review.opendev.org> | 2021-03-05 20:15:22 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2021-03-05 20:15:22 +0000 |
| commit | f802c710835e2e9ac42964c7282bbb4e539b38c5 (patch) | |
| tree | 5481aa54f82e1eb80921ba2591bd0db1dc6d83b3 /glanceclient/v2/images.py | |
| parent | db512d319812542b9b007c1e70e56717f9ffabef (diff) | |
| parent | e0a35a1150a7afe1e28b8d9b59a9e41951276baa (diff) | |
| download | python-glanceclient-3.3.0.tar.gz | |
Merge "Get tasks associated with image"wallaby-em3.3.0
Diffstat (limited to 'glanceclient/v2/images.py')
| -rw-r--r-- | glanceclient/v2/images.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index 341485d..b412c42 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -197,6 +197,25 @@ class Controller(object): return self._get(image_id) @utils.add_req_id_to_object() + def get_associated_image_tasks(self, image_id): + """Get the tasks associated with an image. + + :param image_id: ID of the image + :raises: exc.HTTPNotImplemented if Glance is not new enough to support + this API (v2.12). + """ + # NOTE (abhishekk): Verify that /v2i/images/%s/tasks is supported by + # glance + if utils.has_version(self.http_client, 'v2.12'): + url = '/v2/images/%s/tasks' % image_id + resp, body = self.http_client.get(url) + body.pop('self', None) + return body, resp + else: + raise exc.HTTPNotImplemented( + 'This operation is not supported by Glance.') + + @utils.add_req_id_to_object() def data(self, image_id, do_checksum=True, allow_md5_fallback=False): """Retrieve data of an image. |
