'Deletes the image and all its chunks from the Glance
:param req: The WSGI/Webob Request object
:param id: The opaque image identifier
:raises HttpBadRequest: if image registry is invalid
:raises HttpNotFound: if image or any chunk is not available
:raises HttpUnauthorized: if image or any chunk is not
deleteable by the requesting user'

@utils.mutating
def delete(self, req, id):

    self._enforce(req, 'delete_image')
    image = self.get_image_meta_or_404(req, id)
    if image['protected']:
        msg = _('Image    is    protected')
        LOG.warn(msg)
        raise HTTPForbidden(explanation=msg, request=req, content_type='text/plain')
    if (image['status'] == 'pending_delete'):
        msg = (_('Forbidden    to    delete    a    %s    image.') % image['status'])
        LOG.warn(msg)
        raise HTTPForbidden(explanation=msg, request=req, content_type='text/plain')
    elif (image['status'] == 'deleted'):
        msg = (_('Image    %s    not    found.') % id)
        LOG.warn(msg)
        raise HTTPNotFound(explanation=msg, request=req, content_type='text/plain')
    if (image['location'] and CONF.delayed_delete):
        status = 'pending_delete'
    else:
        status = 'deleted'
    ori_status = image['status']
    try:
        image = registry.update_image_metadata(req.context, id, {'status': status})
        try:
            if image['location']:
                for loc_data in image['location_data']:
                    if (loc_data['status'] == 'active'):
                        upload_utils.initiate_deletion(req, loc_data, id)
        except Exception:
            with excutils.save_and_reraise_exception():
                registry.update_image_metadata(req.context, id, {'status': ori_status})
        registry.delete_image_metadata(req.context, id)
    except exception.ImageNotFound as e:
        msg = (_('Failed    to    find    image    to    delete:    %s') % encodeutils.exception_to_unicode(e))
        LOG.warn(msg)
        raise HTTPNotFound(explanation=msg, request=req, content_type='text/plain')
    except exception.Forbidden as e:
        msg = (_('Forbidden    to    delete    image:    %s') % encodeutils.exception_to_unicode(e))
        LOG.warn(msg)
        raise HTTPForbidden(explanation=msg, request=req, content_type='text/plain')
    except store.InUseByStore as e:
        msg = (_('Image    %(id)s    could    not    be    deleted    because    it    is    in    use:    %(exc)s') % {'id': id, 'exc': encodeutils.exception_to_unicode(e)})
        LOG.warn(msg)
        raise HTTPConflict(explanation=msg, request=req, content_type='text/plain')
    else:
        self.notifier.info('image.delete', redact_loc(image))
        return Response(body='', status=200)
