'Unmap an InfiniBox volume from the host'

@fczm_utils.remove_fc_zone
@infinisdk_to_cinder_exceptions
@coordination.synchronized('infinidat-{self.management_address}-lock')
def terminate_connection(self, volume, connector, **kwargs):

    infinidat_volume = self._get_infinidat_volume(volume)
    if (self._protocol == 'FC'):
        volume_type = 'fibre_channel'
        ports = [wwn.WWN(wwpn) for wwpn in connector['wwpns']]
    else:
        volume_type = 'iscsi'
        ports = [iqn.IQN(connector['initiator'])]
    result_data = dict()
    for port in ports:
        host_name = self._make_host_name(port)
        host = self._system.hosts.safe_get(name=host_name)
        if (host is None):
            continue
        try:
            host.unmap_volume(infinidat_volume)
        except KeyError:
            continue
    if ((host is not None) and (len(host.get_luns()) == 0)):
        host.safe_delete()
        if (self._protocol == 'FC'):
            target_wwpns = list(self._get_online_fc_ports())
            (target_wwpns, target_map) = self._build_initiator_target_map(connector, target_wwpns)
            result_data = dict(target_wwn=target_wwpns, initiator_target_map=target_map)
    return dict(driver_volume_type=volume_type, data=result_data)
