'delete copysession.'

def _delete_copysession(self, cpsession):

    LOG.debug('_delete_copysession:    cpssession:    %s.', cpsession)
    try:
        cpsession_instance = self._get_eternus_instance(cpsession, LocalOnly=False)
    except Exception:
        LOG.info('_delete_copysession,    the    copysession    was    already    completed.')
        return
    copytype = cpsession_instance['CopyType']
    operation = OPERATION_dic.get(copytype, None)
    if (operation is None):
        msg = (_('_delete_copysession,    copy    session    type    is    undefined!    copy    session:    %(cpsession)s,    copy    type:    %(copytype)s.') % {'cpsession': cpsession, 'copytype': copytype})
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    repservice = self._find_eternus_service(REPL)
    if (repservice is None):
        msg = _('_delete_copysession,    Cannot    find    Replication    Service')
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    (rc, errordesc, job) = self._exec_eternus_service('ModifyReplicaSynchronization', repservice, Operation=self._pywbem_uint(operation, '16'), Synchronization=cpsession, Force=True, WaitForCopyState=self._pywbem_uint(15, '16'))
    LOG.debug('_delete_copysession,    copysession:    %(cpsession)s,    operation:    %(operation)s,    Return    code:    %(rc)lu,    Error:    %(errordesc)s.', {'cpsession': cpsession, 'operation': operation, 'rc': rc, 'errordesc': errordesc})
    if (rc == COPYSESSION_NOT_EXIST):
        LOG.debug('_delete_copysession,    cpsession:    %(cpsession)s,    copysession    is    not    exist.', {'cpsession': cpsession})
    elif (rc != 0):
        msg = (_('_delete_copysession,    copysession:    %(cpsession)s,    operation:    %(operation)s,    Return    code:    %(rc)lu,    Error:    %(errordesc)s.') % {'cpsession': cpsession, 'operation': operation, 'rc': rc, 'errordesc': errordesc})
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
