'Delete a snapshot.'

@wsgi.response(204)
@extensions.expected_errors((400, 404))
def delete(self, req, id):

    context = req.environ['nova.context']
    context.can((avs_policies.POLICY_ROOT % 'delete'))
    delete_metadata = {}
    delete_metadata.update(req.GET)
    try:
        delete_info = jsonutils.loads(delete_metadata['delete_info'])
        volume_id = delete_info['volume_id']
    except (KeyError, ValueError) as e:
        raise exc.HTTPBadRequest(explanation=six.text_type(e))
    try:
        self.compute_api.volume_snapshot_delete(context, volume_id, id, delete_info)
    except (exception.VolumeBDMNotFound, exception.InvalidVolume) as error:
        raise exc.HTTPBadRequest(explanation=error.format_message())
    except exception.NotFound as e:
        return exc.HTTPNotFound(explanation=e.format_message())
    except (exception.InstanceInvalidState, exception.InstanceNotReady) as e:
        raise exc.HTTPBadRequest(explanation=e.format_message())
