'Deletes a CG snapshot.'

def _delete_cgsnapshot(self, context, cgsnapshot, snapshots):

    cgname = self._cg_name_from_cgsnapshot(cgsnapshot)
    groupname = self._group_name_from_cgsnapshot_id(cgsnapshot['id'])
    LOG.info('Deleting    snapshot    %(group)s    for    CG    %(cg)s.', {'group': groupname, 'cg': cgname})
    try:
        self._call_xiv_xcli('snap_group_delete', snap_group=groupname).as_list
    except errors.CgDoesNotExistError:
        error = (_('consistency    group    %s    not    found    on    backend') % cgname)
        LOG.error(error)
        raise self._get_exception()(error)
    except errors.PoolSnapshotLimitReachedError:
        error = _('Reached    Maximum    size    allocated    for    snapshots')
        LOG.error(error)
        raise self._get_exception()(error)
    except errors.CgEmptyError:
        error = (_('Consistency    group    %s    is    empty') % cgname)
        LOG.error(error)
        raise self._get_exception()(error)
    except errors.XCLIError as e:
        error = (_('Fatal:    CG    %(cg)s,    Group    %(group)s.    %(err)s') % {'cg': cgname, 'group': groupname, 'err': self._get_code_and_status_or_message(e)})
        LOG.error(error)
        raise self._get_exception()(error)
    model_update = {'status': fields.GroupSnapshotStatus.DELETED}
    snapshots_model_update = []
    for snapshot in snapshots:
        snapshots_model_update.append({'id': snapshot['id'], 'status': fields.SnapshotStatus.DELETED})
    return (model_update, snapshots_model_update)
