'Create map between a volume and a host for FC.'

def connect_volume_fc(self, volume, connector):

    wwns = connector['wwpns']
    LOG.info('initialize_connection_fc,    initiator:    %(wwpns)s,    volume    id:    %(id)s.', {'wwpns': wwns, 'id': volume.id})
    (lun_id, lun_wwn) = huawei_utils.get_volume_lun_id(self.rmt_client, volume)
    if (lun_id is None):
        msg = (_("Can't    get    volume    id.    Volume    name:    %s.") % volume.id)
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    original_host_name = connector['host']
    host_id = self.client.add_host_with_check(original_host_name)
    host_id = self.rmt_client.add_host_with_check(original_host_name)
    online_wwns_in_host = self.rmt_client.get_host_online_fc_initiators(host_id)
    online_free_wwns = self.rmt_client.get_online_free_wwns()
    for wwn in wwns:
        if ((wwn not in online_wwns_in_host) and (wwn not in online_free_wwns)):
            wwns_in_host = self.rmt_client.get_host_fc_initiators(host_id)
            iqns_in_host = self.rmt_client.get_host_iscsi_initiators(host_id)
            if (not (wwns_in_host or iqns_in_host)):
                self.rmt_client.remove_host(host_id)
            msg = _('Can    not    add    FC    port    to    host.')
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)
    for wwn in wwns:
        if (wwn in online_free_wwns):
            self.rmt_client.add_fc_port_to_host(host_id, wwn)
    (tgt_port_wwns, init_targ_map) = self.rmt_client.get_init_targ_map(wwns)
    hostgroup_id = self.rmt_client.add_host_to_hostgroup(host_id)
    map_info = self.rmt_client.do_mapping(lun_id, hostgroup_id, host_id, hypermetro_lun=True)
    if (not map_info):
        msg = _('Map    info    is    None    due    to    array    version    not    supporting    hypermetro.')
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    host_lun_id = self.rmt_client.get_host_lun_id(host_id, lun_id)
    fc_info = {'driver_volume_type': 'fibre_channel', 'data': {'target_lun': int(host_lun_id), 'target_discovered': True, 'target_wwn': tgt_port_wwns, 'volume_id': volume.id, 'initiator_target_map': init_targ_map, 'map_info': map_info}}
    LOG.info('Remote    return    FC    info    is:    %s.', fc_info)
    return fc_info
