summaryrefslogtreecommitdiff
path: root/glanceclient/v2
diff options
context:
space:
mode:
Diffstat (limited to 'glanceclient/v2')
-rw-r--r--glanceclient/v2/images.py8
-rw-r--r--glanceclient/v2/shell.py18
2 files changed, 26 insertions, 0 deletions
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index 69163fe..1e8e621 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -303,6 +303,14 @@ class Controller(object):
return body, resp
@utils.add_req_id_to_object()
+ def delete_from_store(self, store_id, image_id):
+ """Delete image data from specific store."""
+ url = ('/v2/stores/%(store)s/%(image)s' % {'store': store_id,
+ 'image': image_id})
+ resp, body = self.http_client.delete(url)
+ return body, resp
+
+ @utils.add_req_id_to_object()
def stage(self, image_id, image_data, image_size=None):
"""Upload the data to image staging.
diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py
index 3193a88..b4dc811 100644
--- a/glanceclient/v2/shell.py
+++ b/glanceclient/v2/shell.py
@@ -556,6 +556,24 @@ def do_stores_info(gc, args):
utils.print_dict(stores_info)
+@utils.arg('id', metavar='<IMAGE_ID>', help=_('ID of image to update.'))
+@utils.arg('--store', metavar='<STORE_ID>', required=True,
+ help=_('Store to delete image from.'))
+def do_stores_delete(gc, args):
+ """Delete image from specific store."""
+ try:
+ gc.images.delete_from_store(args.store, args.id)
+ except exc.HTTPNotFound:
+ utils.exit('Multi Backend support is not enabled or Image/store not '
+ 'found.')
+ except (exc.HTTPForbidden, exc.HTTPException) as e:
+ msg = ("Unable to delete image '%s' from store '%s'. (%s)" % (
+ args.id,
+ args.store,
+ e))
+ utils.exit(msg)
+
+
@utils.arg('--allow-md5-fallback', action='store_true',
default=utils.env('OS_IMAGE_ALLOW_MD5_FALLBACK', default=False),
help=_('If os_hash_algo and os_hash_value properties are available '