'Deletes a cgsnapshot.'

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

    snapshots = objects.SnapshotList().get_all_for_group_snapshot(context, cgsnapshot.id)
    model_update = {}
    model_update['status'] = cgsnapshot.status
    LOG.info('Delete    cgsnapshot    %(snap_name)s    for    consistency    group:    %(group_name)s', {'snap_name': cgsnapshot.id, 'group_name': cgsnapshot.group_id})
    try:
        self.dpl.delete_vdev_snapshot(self._conver_uuid2hex(cgsnapshot.group_id), self._conver_uuid2hex(cgsnapshot.id), True)
        for snapshot in snapshots:
            snapshot.status = fields.SnapshotStatus.DELETED
    except Exception as e:
        msg = (_('Failed    to    delete    cgsnapshot    %(id)s    due    to    %(reason)s.') % {'id': cgsnapshot.id, 'reason': six.text_type(e)})
        raise exception.VolumeBackendAPIException(data=msg)
    model_update['status'] = 'deleted'
    return (model_update, snapshots)
