'Delete a consistency group.'

def _delete_consistencygroup(self, context, group, volumes):

    ret = 0
    volumes = self.db.volume_get_all_by_group(context, group.id)
    model_update = {}
    model_update['status'] = group.status
    LOG.info('Start    to    delete    consistency    group:    %(cg_name)s', {'cg_name': group.id})
    try:
        self.dpl.delete_vg(self._conver_uuid2hex(group.id))
    except Exception as e:
        msg = (_('Failed    to    delete    consistency    group    %(id)s    due    to    %(reason)s.') % {'id': group.id, 'reason': six.text_type(e)})
        raise exception.VolumeBackendAPIException(data=msg)
    for volume_ref in volumes:
        try:
            self.dpl.delete_vdev(self._conver_uuid2hex(volume_ref['id']))
            volume_ref['status'] = 'deleted'
        except Exception:
            ret = errno.EFAULT
            volume_ref['status'] = 'error_deleting'
            model_update['status'] = fields.GroupStatus.ERROR_DELETING
    if (ret == 0):
        model_update['status'] = fields.GroupStatus.DELETED
    return (model_update, volumes)
