@Throws(Exception::class) private fun processTargetPortsToFormHSDs( hdsApiClient: HDSApiClient, storage: StorageSystem, targetURIList: List<URI>, hostName: String, exportMask: ExportMask, hostModeInfo: Pair<String, String>?, systemObjectID: String ): List<HostStorageDomain?>? { val hsdList: List<HostStorageDomain> = ArrayList<HostStorageDomain>() var hostMode: String? = null var hostModeOption: String? = null if (hostModeInfo != null) { hostMode = hostModeInfo.first hostModeOption = hostModeInfo.second } for (targetPortURI in targetURIList) { val storagePort: StoragePort = dbClient.queryObject(StoragePort::class.java, targetPortURI) val storagePortNumber: String = getStoragePortNumber(storagePort.getNativeGuid()) val dataSource: DataSource = dataSourceFactory.createHSDNickNameDataSource(hostName, storagePortNumber, storage) val hsdNickName: String = customConfigHandler.getComputedCustomConfigValue( CustomConfigConstants.HDS_HOST_STORAGE_DOMAIN_NICKNAME_MASK_NAME, storage.getSystemType(), dataSource ) if (Transport.IP.name().equalsIgnoreCase(storagePort.getTransportType())) { log.info("Populating iSCSI HSD for storage: {}", storage.getSerialNumber()) val hostGroup = HostStorageDomain( storagePortNumber, exportMask.getMaskName(), HDSConstants.ISCSI_TARGET_DOMAIN_TYPE, hsdNickName ) hostGroup.setHostMode(hostMode) hostGroup.setHostModeOption(hostModeOption) hsdList.add(hostGroup) } if (Transport.FC.name().equalsIgnoreCase(storagePort.getTransportType())) { log.info("Populating FC HSD for storage: {}", storage.getSerialNumber()) val hostGroup = HostStorageDomain( storagePortNumber, exportMask.getMaskName(), HDSConstants.HOST_GROUP_DOMAIN_TYPE, hsdNickName ) hostGroup.setHostMode(hostMode) hostGroup.setHostModeOption(hostModeOption) hsdList.add(hostGroup) } } return hsdList }
This routine iterates through the target ports and prepares a batch of HostStorageDomain Objects with required information .