'Disallow connection from connector.'

@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):

    "\n                                                connector    =    {'ip':    CONF.my_ip,\n                                                                                                    'host':    CONF.host,\n                                                                                                    'initiator':    self._initiator,\n                                                                                                    'wwnns':    self._fc_wwnns,\n                                                                                                    'wwpns':    self._fc_wwpns}\n                                "
    lstargetWwpns = []
    lsTargets = []
    szwwpns = []
    ret = 0
    info = {'driver_volume_type': 'fibre_channel', 'data': {}}
    LOG.info('terminate_connection    volume:    %(volume)s,    connector:    %(con)s', {'volume': volume, 'con': connector})
    for dwwpn in connector['wwpns']:
        szwwpn = self._convertHex2String(dwwpn)
        if (len(szwwpn) == 0):
            msg = (_('Invalid    wwpns    format    %(wwpns)s') % {'wwpns': connector['wwpns']})
            raise exception.VolumeBackendAPIException(data=msg)
        szwwpns.append(szwwpn)
    if (len(szwwpns) == 0):
        ret = errno.EFAULT
        msg = (_('Invalid    wwpns    format    %(wwpns)s') % {'wwpns': connector['wwpns']})
        raise exception.VolumeBackendAPIException(data=msg)
    else:
        for szwwpn in szwwpns:
            lstargetWwpns = self._get_targetwpns(self._conver_uuid2hex(volume['id']), szwwpn)
            lsTargets = list(set((lsTargets + lstargetWwpns)))
    try:
        for ptarget in lsTargets:
            ret = self._delete_export_fc(volume['id'], ptarget, szwwpns)
            if ret:
                break
    except Exception:
        ret = errno.EFAULT
    finally:
        if ret:
            msg = (_('Faield    to    unassign    %(volume)s') % volume['id'])
            raise exception.VolumeBackendAPIException(data=msg)
    if ret:
        init_targ_map = self._build_initiator_target_map(connector, lsTargets)
        info['data'] = {'target_wwn': lsTargets, 'initiator_target_map': init_targ_map}
    return info
