'Deletes a snapshot.'

@utils.trace_method
def delete_snapshot(self, snapshot):

    meta = snapshot.get('metadata')
    if ('force' in meta.keys()):
        LOG.debug('Found    force    flag    for    snapshot    metadata.    Not    sending    call    to    datanode    ')
        LOG.debug('snapshot    metadata    %s', meta)
        return
    if ('is_busy' in meta.keys()):
        LOG.warning('Snapshot    %s    is    being    used,    skipping    delete', snapshot['id'])
        raise exception.SnapshotIsBusy(snapshot_name=snapshot['id'])
    else:
        LOG.warning('Snapshot    %s    is    being    deleted,    is_busy    key    not    present', snapshot['id'])
    message_body = {}
    message_body['volume_guid'] = util.get_guid_with_curly_brackets(snapshot['volume_id'])
    message_body['snapshot_id'] = util.get_guid_with_curly_brackets(snapshot['id'])
    rt_key = None
    snapshot_volume = snapshot.get('volume')
    metadata = snapshot_volume['metadata']
    rt_key = self._get_volume_metadata_value(metadata, 'current_dn_owner')
    if (rt_key is None):
        rt_key = self.dn_routing_key
    try:
        util.message_data_plane(rt_key, 'hyperscale.storage.dm.version.delete', **message_body)
    except (exception.UnableToExecuteHyperScaleCmd, exception.UnableToProcessHyperScaleCmdOutput):
        with excutils.save_and_reraise_exception():
            LOG.exception('Exception    in    delete    snapshot')
