'Deletes a cgsnapshot.'

def delete_cgsnapshot(self, cgsnapshot, snapshots):

    cg_id = cgsnapshot['consistencygroup_id']
    cg_name = utils.convert_uuid_to_es_fmt(cg_id)
    es_cg = self._get_consistencygroup_by_name(cg_name)
    min_seq_num = min(es_cg['uniqueSequenceNumber'])
    es_snapshots = self._client.get_consistency_group_snapshots(es_cg['id'])
    es_snap_ids = set((snap.get('provider_id') for snap in snapshots))
    seq_num = None
    for snap in es_snapshots:
        if (snap['id'] in es_snap_ids):
            seq_num = snap['pitSequenceNumber']
            break
    if (seq_num is None):
        raise exception.CgSnapshotNotFound(cgsnapshot_id=cg_id)
    if (int(seq_num) <= int(min_seq_num)):
        self._client.delete_consistency_group_snapshot(es_cg['id'], seq_num)
        return (None, None)
    else:
        return cinder_utils.synchronized(cg_id)(self._soft_delete_cgsnapshot)(es_cg, seq_num)
