'_get_mapdata for iSCSI.'

def _get_mapdata_iscsi(self, aglist, vol_instance, multipath):

    target_portals = []
    target_iqns = []
    target_luns = []
    try:
        vo_volmaplist = self._reference_eternus_names(vol_instance.path, ResultClass='CIM_ProtocolControllerForUnit')
    except Exception:
        msg = (_('_get_mapdata_iscsi,    vol_instance:    %(vol_instance)s,    ReferenceNames:    CIM_ProtocolControllerForUnit,    cannot    connect    to    ETERNUS.') % {'vol_instance': vol_instance})
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    target_properties_list = self._get_eternus_iscsi_properties()
    target_list = [prop[0] for prop in target_properties_list]
    properties_list = [(prop[1], prop[2]) for prop in target_properties_list]
    for ag in aglist:
        try:
            iscsi_endpointlist = self._assoc_eternus_names(ag, AssocClass='FUJITSU_SAPAvailableForElement', ResultClass='FUJITSU_iSCSIProtocolEndpoint')
        except Exception:
            msg = _('_get_mapdata_iscsi,    Associators:    FUJITSU_SAPAvailableForElement,    cannot    connect    to    ETERNUS.')
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)
        iscsi_endpoint = iscsi_endpointlist[0]
        if (iscsi_endpoint not in target_list):
            continue
        idx = target_list.index(iscsi_endpoint)
        (target_portal, target_iqn) = properties_list[idx]
        try:
            ag_volmaplist = self._reference_eternus_names(ag, ResultClass='CIM_ProtocolControllerForUnit')
        except Exception:
            msg = (_('_get_mapdata_iscsi,    affinitygroup:    %(ag)s,    ReferenceNames,    cannot    connect    to    ETERNUS.') % {'ag': ag})
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)
        volmap = None
        for vo_volmap in vo_volmaplist:
            if (vo_volmap in ag_volmaplist):
                volmap = vo_volmap
                break
        if (volmap is None):
            continue
        try:
            volmapinstance = self._get_eternus_instance(volmap, LocalOnly=False)
        except Exception:
            msg = (_('_get_mapdata_iscsi,    volmap:    %(volmap)s,    GetInstance,    cannot    connect    to    ETERNUS.') % {'volmap': volmap})
            LOG.error(msg)
            raise exception.VolumeBackendAPIException(data=msg)
        target_lun = int(volmapinstance['DeviceNumber'], 16)
        target_portals.append(target_portal)
        target_iqns.append(target_iqn)
        target_luns.append(target_lun)
    if multipath:
        mapdata = {'target_portals': target_portals, 'target_iqns': target_iqns, 'target_luns': target_luns}
    else:
        mapdata = {'target_portal': target_portals[0], 'target_iqn': target_iqns[0], 'target_lun': target_luns[0]}
    LOG.debug('_get_mapdata_iscsi,    mapdata:    %s.', mapdata)
    return mapdata
