def createRemoteScsiAdapterOsh(vScsi, remoteLparOsh): """ Creates Object State Holder for SCSI Adapter CI on the remote LPar @param scsiAdapter: the discovered SCSI Adapter @type scsiAdapter: instance of the ScsiAdapter Data Object @param remoteLparOsh: Object State Holder of the Host this SCSI Adapter belongs to @type remoteLparOsh: OSH instance of a Host CI or any of its siblings @return: SCSI Adapter OSH """ if vScsi and remoteLparOsh: remoteScsi = storage_topology.ScsiAdapter() remoteScsi.isVirtual = 1 remoteScsi.slotNumber = vScsi.remoteSlotNumber remoteScsi.type = 'client' return storage_topology.createScsiAdapterOsh(remoteScsi, remoteLparOsh)
def doDiscovery(shell, hostOsh, managedSystemOsh, framework, osType): vector = ObjectStateHolderVector() scsiAdaptersList = [] physAdaptList = [] virtAdaptList = [] seaAdaptList = [] linkAggrAdaptList = [] volumeGroupsDict = {} physicalVolumeDict = {} logicalVolumeDict = {} scsiManList = [] pvAssignList = [] fiberChannelAdaptersList = [] ethAliasesList = [] isVio = ibm_hmc_lib.isVio(shell) if isVio: try: cpus = discoverCpus(shell) for cpu in cpus: cpuOsh = modeling.createCpuOsh(cpu.idStr, managedSystemOsh, cpu.speed, cpu.coresCount, 'ibm_corp', data_name = cpu.model) vector.add(cpuOsh) except: logger.errorException('') framework.reportWarning('Failed to discover CPUs') if osType and osType.upper() == 'AIX': try: fiberChannelAdaptersList = discoverFiberChannels(shell) except: framework.reportWarning("Failed to discover Fibre Channel adapters") ethAdaptersDict = {} if isVio: ethAdaptersDict = discoverEthernetAdapters(shell) ethAliasesList = discoverEhernetAdapterAliasses(shell) else: ethAdaptersDict = discoverAixLparEthernetAdapters(shell) physAdaptList = getPhysicalEthAdapters(ethAdaptersDict.values()) virtAdaptList = getVirtualEthAdapters(ethAdaptersDict.values()) seaAdaptList = getSeaAdapters(ethAdaptersDict.values()) linkAggrAdaptList = getLinkAggregationInterfaces(ethAdaptersDict.values()) calculateAdaptersSpeed(linkAggrAdaptList, ethAdaptersDict) calculateAdaptersSpeed(seaAdaptList, ethAdaptersDict) calculateAdaptersSpeed(virtAdaptList, ethAdaptersDict) volumeGroupsDict = discoverVolumeGroups(shell) physicalVolumeDict = discoverPhysicalVolumes(shell) logicalVolumeDict = discoverLogicalVolumes(shell, volumeGroupsDict) if isVio: scsiAdaptersList = discoverScsi(shell, physicalVolumeDict, logicalVolumeDict) (scsiManList, pvAssignList) = discoverPhysScsiAndRaid(shell, physicalVolumeDict) else: (scsiManList, pvAssignList) = discoverLparPhysScsiAndRaid(shell, physicalVolumeDict) elif osType and osType.upper() == 'LINUX': scsiAdaptersList = discoverLinuxVScsiAdapters(shell) (volumeGroupsDict, logicalVolumeDict, physicalVolumeDict) = discoverLinuxStorageInfo(shell) ethAdaptersDict = {} if physAdaptList: for physAdapt in physAdaptList: physAdaptOsh = createInterfaceOsh(physAdapt, hostOsh) linkOsh = modeling.createLinkOSH('contained', managedSystemOsh, physAdaptOsh) vector.add(linkOsh) if physAdapt.physicalPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = physAdapt.physicalPath ioSlot.drcName = physAdapt.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, physAdaptOsh) vector.add(ioSlotOsh) vector.add(linkOsh) if ethAliasesList: for aliasName in ['en'+str(physAdapt.interfaceIndex), 'et'+str(physAdapt.interfaceIndex)]: if aliasName in ethAliasesList: aliasOsh = createAliasOsh(aliasName, hostOsh, physAdapt) if aliasOsh: vector.add(aliasOsh) vector.add(vector.add(modeling.createLinkOSH('realization', physAdaptOsh, aliasOsh))) if logger.Version().getVersion(framework) < 9: interfaceIndexOsh = createInterfaceIndexOsh(physAdapt, hostOsh) if interfaceIndexOsh: linkOsh = modeling.createLinkOSH('parent', interfaceIndexOsh, physAdaptOsh) vector.add(interfaceIndexOsh) vector.add(linkOsh) # vector.add(physAdaptOsh) ethAdaptersDict[physAdapt.name] = physAdaptOsh if linkAggrAdaptList: for linkAggr in linkAggrAdaptList: linkAggrOsh = createLinkAggrOsh(linkAggr, hostOsh) if linkAggr.usedAdapters: vector.add(linkAggrOsh) ethAdaptersDict[linkAggr.name] = linkAggrOsh for usedAdapterName in linkAggr.usedAdapters: physAdaptOsh = ethAdaptersDict.get(usedAdapterName) if physAdaptOsh: #change the KEY attribute for the Physical Ethernet Adapter mac = physAdaptOsh.getAttributeValue('interface_macaddr') newKey = '%s_%s' % (mac, usedAdapterName) physAdaptOsh.setAttribute('interface_macaddr', newKey) ethAdaptersDict[usedAdapterName] = physAdaptOsh linkOsh = modeling.createLinkOSH('member', linkAggrOsh, physAdaptOsh) vector.add(linkOsh) if linkAggr.backupAdapter: ethBackOsh = ethAdaptersDict.get(linkAggr.backupAdapter) linkOsh = modeling.createLinkOSH('member', linkAggrOsh, ethBackOsh) vector.add(linkOsh) #Adding Physical ETH adapters to the result vector if ethAdaptersDict: for physAdaptOsh in ethAdaptersDict.values(): vector.add(physAdaptOsh) if seaAdaptList: for seaAdapter in seaAdaptList: seaAdapterOsh = createSeaOsh(seaAdapter, hostOsh) if seaAdapter.usedAdapters: vector.add(seaAdapterOsh) ethAdaptersDict[seaAdapter.name] = seaAdapterOsh for usedAdapterName in seaAdapter.usedAdapters: backAdapterOsh = ethAdaptersDict.get(usedAdapterName) if backAdapterOsh: linkOsh = modeling.createLinkOSH('use', seaAdapterOsh, backAdapterOsh) vector.add(linkOsh) if virtAdaptList: for virtualAdapter in virtAdaptList: virtAdapterOsh = ibm_hmc_lib.createVEthOsh(virtualAdapter, hostOsh) vector.add(virtAdapterOsh) if ethAliasesList: for aliasName in ['en'+str(virtualAdapter.interfaceIndex), 'et'+str(virtualAdapter.interfaceIndex)]: if aliasName in ethAliasesList: aliasOsh = createAliasOsh(aliasName, hostOsh, virtualAdapter) if aliasOsh: vector.add(aliasOsh) vector.add(vector.add(modeling.createLinkOSH('realization', virtAdapterOsh, aliasOsh))) if virtualAdapter.usedAdapters: for usedAdapterName in virtualAdapter.usedAdapters: backAdapterOsh = ethAdaptersDict.get(usedAdapterName) if backAdapterOsh: linkOsh = modeling.createLinkOSH('use', virtAdapterOsh, backAdapterOsh) vector.add(linkOsh) #FIXME: move to function to avoid code dups if virtualAdapter.physicalPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = virtualAdapter.physicalPath ioSlot.drcName = virtualAdapter.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName) if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, virtAdapterOsh) vector.add(ioSlotOsh) vector.add(linkOsh) if fiberChannelAdaptersList: for fiberChannelAdapter in fiberChannelAdaptersList: fiberChannelOsh = createFiberChannelOsh(fiberChannelAdapter, managedSystemOsh) vector.add(fiberChannelOsh) linkOsh = modeling.createLinkOSH('contained', hostOsh, fiberChannelOsh) vector.add(linkOsh) if fiberChannelAdapter.physPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = fiberChannelAdapter.physPath ioSlot.drcName = fiberChannelAdapter.physPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, fiberChannelOsh) vector.add(ioSlotOsh) vector.add(linkOsh) #create Storage Topology vector.addAll(storage_topology.createStorageTopology(volumeGroupsDict.values(), logicalVolumeDict.values(), physicalVolumeDict.values(), scsiAdaptersList, hostOsh)) if scsiManList and pvAssignList: pScsiDict = {} for scsi in scsiManList: scsiOsh = None ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = scsi.physicalPath ioSlot.drcName = scsi.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh) scsiOsh = storage_topology.createScsiAdapterOsh(scsi, managedSystemOsh) linkOsh = modeling.createLinkOSH('contained', hostOsh, scsiOsh) vector.add(linkOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) scsiOsh = storage_topology.createScsiAdapterOsh(scsi, hostOsh) vector.add(scsiOsh) pScsiDict[scsi.slotNumber] = scsiOsh linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, scsiOsh) vector.add(ioSlotOsh) vector.add(linkOsh) for pv in pvAssignList: pvOsh = storage_topology.createPhysicalVolumeOsh(pv, hostOsh) scsiOsh = pScsiDict.get(pv.scsiAdapterSlotNumber) if pvOsh and scsiOsh: vector.add(pvOsh) linkOsh = modeling.createLinkOSH("depend", pvOsh, scsiOsh) vector.add(linkOsh) return vector
def ReportTopology(chassises, servers, system_pools, vms, switches, storages, fsm_osh, reportHostName): vector = ObjectStateHolderVector() vector.add(fsm_osh) vm_map = {} for vm in vms: key = '%s%s' % (vm.serial, vm.vm_id) vm_map[key] = vm chassis_name_to_chassis_osh = {} server_serial_to_server_osh = {} server_serial_to_interfaces = {} if chassises: for chassis in chassises: vect, chassis_osh = reportChassis(chassis, fsm_osh) chassis_name_to_chassis_osh[chassis.name] = chassis_osh if chassis.name and chassis.name.find(' ') != -1: chassis_name_to_chassis_osh[ chassis.name[:chassis.name.find(' ')]] = chassis_osh vector.addAll(vect) if servers: for server in servers: vect, server_osh, iface_map = reportServer( server, chassis_name_to_chassis_osh) if not server_osh: continue vector.addAll(vect) server_serial_to_server_osh[server.serial] = server_osh server_serial_to_interfaces[server.serial] = iface_map #report cpu pools cpuPoolOshDict = {} hypervisor_osh = createIbmHypervisorOsh(server_osh) if server.managedSystem and server.managedSystem.cpuPoolList: cpuQuont = 0 for processorPool in server.managedSystem.cpuPoolList: processorPoolOsh = createProcessorPoolOsh( processorPool, hypervisor_osh) vector.add(processorPoolOsh) cpuPoolOshDict[processorPool.name] = processorPoolOsh if processorPool.physCpuConf: cpuQuont += int(processorPool.physCpuConf) for i in xrange(cpuQuont): cpuOsh = modeling.createCpuOsh( 'CPU' + str(i), server_osh) linkOsh = modeling.createLinkOSH( 'contained', processorPoolOsh, cpuOsh) vector.add(linkOsh) #reporting vms lparOshDict = {} if server.managedSystem.lparProfilesDict: for lpar in server.managedSystem.lparProfilesDict.values(): if lpar.type not in ('aixlinux', 'os400', 'vioserver'): continue #if lpar.lparProfile.lparIpAddress or (reportHostName and reportHostName.lower().strip() == 'true'): #creating Lpar # virtualHostOsh = modeling.createHostOSH(lpar.lparProfile.lparIpAddress, 'host', lpar.osName) virtualHostOsh = None host_class = getHostClassByEnvType(lpar.type) vect, virtualHostOsh = reportVirtualMachine( vm_map, server, server_osh, host_class, lpar, server_serial_to_interfaces) vector.addAll(vect) if not virtualHostOsh: logger.warn('Failed to create Lpar %s ' % lpar.lparName) continue if reportHostName and reportHostName.lower().strip( ) == 'true': virtualHostOsh.setStringAttribute( 'name', lpar.lparName) lparOshDict[lpar.lparId] = virtualHostOsh vector.add(virtualHostOsh) #creating Lpar Profile lparProfileOsh = createLparProfileOsh(lpar, virtualHostOsh) vector.add(lparProfileOsh) #Linking Lpar to Shared Pool if lpar.sharedPoolId and cpuPoolOshDict.has_key( lpar.sharedPoolId): linkOsh = modeling.createLinkOSH( 'use', virtualHostOsh, cpuPoolOshDict[lpar.sharedPoolId]) vector.add(linkOsh) if server.managedSystem.vScsiList: for vScsi in server.managedSystem.vScsiList: localLparOsh = lparOshDict.get(vScsi.parentId) remoteLparOsh = lparOshDict.get(vScsi.remoteLparId) if localLparOsh and remoteLparOsh: localVScsiOsh = storage_topology.createScsiAdapterOsh( vScsi, localLparOsh) remoteVScsiOsh = createRemoteScsiAdapterOsh( vScsi, remoteLparOsh) linkOsh = modeling.createLinkOSH( 'use', remoteVScsiOsh, localVScsiOsh) vector.add(localVScsiOsh) vector.add(remoteVScsiOsh) vector.add(linkOsh) # create and link v I/O Slot to vSCSI for vIoSlot in server.managedSystem.vIoSlotList: if vIoSlot.slotType == 'scsi' and vIoSlot.lpar_id == vScsi.parentId and vIoSlot.slotNum == vScsi.slotNumber: vIoSlotOsh = ibm_hmc_lib.createIoSlotOsh( vIoSlot, localLparOsh) linkOsh = modeling.createLinkOSH( 'contained', vIoSlotOsh, localVScsiOsh) vector.add(vIoSlotOsh) vector.add(linkOsh) if vIoSlot.slotType == 'scsi' and vIoSlot.lpar_id == vScsi.remoteLparId and vIoSlot.slotNum == vScsi.remoteSlotNumber: vIoSlotOsh = ibm_hmc_lib.createIoSlotOsh( vIoSlot, remoteLparOsh) linkOsh = modeling.createLinkOSH( 'contained', vIoSlotOsh, remoteVScsiOsh) vector.add(vIoSlotOsh) vector.add(linkOsh) if storages: for subsystem in storages: vect, subsystem_osh = reportStorageSystem(subsystem, fsm_osh) vector.addAll(vect) if switches: for switch in switches: try: vect, sw_osh = reportSwitch(switch, chassis_name_to_chassis_osh, server_serial_to_interfaces, fsm_osh) except: logger.debug("Failed to report Switch. Data missing.") return vector
def ReportTopology(chassises, servers, system_pools, vms, switches, storages, fsm_osh, reportHostName): vector = ObjectStateHolderVector() vector.add(fsm_osh) vm_map = {} for vm in vms: key = '%s%s' % (vm.serial, vm.vm_id) vm_map[key] = vm chassis_name_to_chassis_osh = {} server_serial_to_server_osh = {} server_serial_to_interfaces = {} if chassises: for chassis in chassises: vect, chassis_osh = reportChassis(chassis, fsm_osh) chassis_name_to_chassis_osh[chassis.name] = chassis_osh if chassis.name and chassis.name.find(' ') != -1: chassis_name_to_chassis_osh[chassis.name[:chassis.name.find(' ')]] = chassis_osh vector.addAll(vect) if servers: for server in servers: vect, server_osh, iface_map = reportServer(server, chassis_name_to_chassis_osh) if not server_osh: continue vector.addAll(vect) server_serial_to_server_osh[server.serial] = server_osh server_serial_to_interfaces[server.serial] = iface_map #report cpu pools cpuPoolOshDict = {} hypervisor_osh = createIbmHypervisorOsh(server_osh) if server.managedSystem and server.managedSystem.cpuPoolList: cpuQuont = 0 for processorPool in server.managedSystem.cpuPoolList: processorPoolOsh = createProcessorPoolOsh(processorPool, hypervisor_osh) vector.add(processorPoolOsh) cpuPoolOshDict[processorPool.name] = processorPoolOsh if processorPool.physCpuConf: cpuQuont += int(processorPool.physCpuConf) for i in xrange(cpuQuont): cpuOsh = modeling.createCpuOsh('CPU' + str(i), server_osh) linkOsh = modeling.createLinkOSH('contained', processorPoolOsh, cpuOsh) vector.add(linkOsh) #reporting vms lparOshDict = {} if server.managedSystem.lparProfilesDict: for lpar in server.managedSystem.lparProfilesDict.values(): if lpar.type not in ('aixlinux', 'os400', 'vioserver'): continue #if lpar.lparProfile.lparIpAddress or (reportHostName and reportHostName.lower().strip() == 'true'): #creating Lpar # virtualHostOsh = modeling.createHostOSH(lpar.lparProfile.lparIpAddress, 'host', lpar.osName) virtualHostOsh = None host_class = getHostClassByEnvType(lpar.type) vect, virtualHostOsh = reportVirtualMachine(vm_map, server, server_osh, host_class, lpar, server_serial_to_interfaces) vector.addAll(vect) if not virtualHostOsh: logger.warn('Failed to create Lpar %s ' % lpar.lparName) continue if reportHostName and reportHostName.lower().strip() == 'true': virtualHostOsh.setStringAttribute('name', lpar.lparName) lparOshDict[lpar.lparId] = virtualHostOsh vector.add(virtualHostOsh) #creating Lpar Profile lparProfileOsh = createLparProfileOsh(lpar, virtualHostOsh) vector.add(lparProfileOsh) #Linking Lpar to Shared Pool if lpar.sharedPoolId and cpuPoolOshDict.has_key(lpar.sharedPoolId): linkOsh = modeling.createLinkOSH('use', virtualHostOsh, cpuPoolOshDict[lpar.sharedPoolId]) vector.add(linkOsh) if server.managedSystem.vScsiList: for vScsi in server.managedSystem.vScsiList: localLparOsh = lparOshDict.get(vScsi.parentId) remoteLparOsh = lparOshDict.get(vScsi.remoteLparId) if localLparOsh and remoteLparOsh: localVScsiOsh = storage_topology.createScsiAdapterOsh(vScsi, localLparOsh) remoteVScsiOsh = createRemoteScsiAdapterOsh(vScsi, remoteLparOsh) linkOsh = modeling.createLinkOSH('use', remoteVScsiOsh, localVScsiOsh) vector.add(localVScsiOsh) vector.add(remoteVScsiOsh) vector.add(linkOsh) # create and link v I/O Slot to vSCSI for vIoSlot in server.managedSystem.vIoSlotList: if vIoSlot.slotType == 'scsi' and vIoSlot.lpar_id == vScsi.parentId and vIoSlot.slotNum == vScsi.slotNumber: vIoSlotOsh = ibm_hmc_lib.createIoSlotOsh(vIoSlot, localLparOsh) linkOsh = modeling.createLinkOSH('contained', vIoSlotOsh, localVScsiOsh) vector.add(vIoSlotOsh) vector.add(linkOsh) if vIoSlot.slotType == 'scsi' and vIoSlot.lpar_id == vScsi.remoteLparId and vIoSlot.slotNum == vScsi.remoteSlotNumber: vIoSlotOsh = ibm_hmc_lib.createIoSlotOsh(vIoSlot, remoteLparOsh) linkOsh = modeling.createLinkOSH('contained', vIoSlotOsh, remoteVScsiOsh) vector.add(vIoSlotOsh) vector.add(linkOsh) if storages: for subsystem in storages: vect, subsystem_osh = reportStorageSystem(subsystem, fsm_osh) vector.addAll(vect) if switches: for switch in switches: try: vect, sw_osh = reportSwitch(switch, chassis_name_to_chassis_osh, server_serial_to_interfaces, fsm_osh) except: logger.debug("Failed to report Switch. Data missing.") return vector
def doDiscovery(shell, hostOsh, managedSystemOsh, framework, osType): vector = ObjectStateHolderVector() scsiAdaptersList = [] physAdaptList = [] virtAdaptList = [] seaAdaptList = [] linkAggrAdaptList = [] volumeGroupsDict = {} physicalVolumeDict = {} logicalVolumeDict = {} scsiManList = [] pvAssignList = [] fiberChannelAdaptersList = [] ethAliasesList = [] isVio = ibm_hmc_lib.isVio(shell) try: cpus = discover_cpus(shell, framework, isVio) for cpu in cpus: cpuOsh = modeling.createCpuOsh(cpu.idStr, managedSystemOsh, cpu.speed, cpu.coresCount, 'ibm_corp', data_name=cpu.model) vector.add(cpuOsh) except: logger.errorException('') framework.reportWarning('Failed to discover CPUs') if osType and osType.upper() == 'AIX': try: fiberChannelAdaptersList = discoverFiberChannels(shell) except: framework.reportWarning( "Failed to discover Fibre Channel adapters") ethAdaptersDict = {} if isVio: ethAdaptersDict = discoverEthernetAdapters(shell) ethAliasesList = discoverEhernetAdapterAliasses(shell) else: ethAdaptersDict = discoverAixLparEthernetAdapters(shell) physAdaptList = getPhysicalEthAdapters(ethAdaptersDict.values()) virtAdaptList = getVirtualEthAdapters(ethAdaptersDict.values()) seaAdaptList = getSeaAdapters(ethAdaptersDict.values()) linkAggrAdaptList = getLinkAggregationInterfaces( ethAdaptersDict.values()) calculateAdaptersSpeed(linkAggrAdaptList, ethAdaptersDict) calculateAdaptersSpeed(seaAdaptList, ethAdaptersDict) calculateAdaptersSpeed(virtAdaptList, ethAdaptersDict) volumeGroupsDict = discoverVolumeGroups(shell) physicalVolumeDict = discoverPhysicalVolumes(shell) logicalVolumeDict = discoverLogicalVolumes(shell, volumeGroupsDict) if isVio: scsiAdaptersList = discoverScsi(shell, physicalVolumeDict, logicalVolumeDict) (scsiManList, pvAssignList) = discoverPhysScsiAndRaid(shell, physicalVolumeDict) else: (scsiManList, pvAssignList) = discoverLparPhysScsiAndRaid( shell, physicalVolumeDict) elif osType and osType.upper() == 'LINUX': scsiAdaptersList = discoverLinuxVScsiAdapters(shell) (volumeGroupsDict, logicalVolumeDict, physicalVolumeDict) = discoverLinuxStorageInfo(shell) ethAdaptersDict = {} if physAdaptList: for physAdapt in physAdaptList: physAdaptOsh = createInterfaceOsh(physAdapt, hostOsh) linkOsh = modeling.createLinkOSH('contained', managedSystemOsh, physAdaptOsh) vector.add(linkOsh) if physAdapt.physicalPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = physAdapt.physicalPath ioSlot.drcName = physAdapt.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName( ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh( ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, physAdaptOsh) vector.add(ioSlotOsh) vector.add(linkOsh) if ethAliasesList: for aliasName in [ 'en' + str(physAdapt.interfaceIndex), 'et' + str(physAdapt.interfaceIndex) ]: if aliasName in ethAliasesList: aliasOsh = createAliasOsh(aliasName, hostOsh, physAdapt) if aliasOsh: vector.add(aliasOsh) vector.add( vector.add( modeling.createLinkOSH( 'realization', physAdaptOsh, aliasOsh))) if logger.Version().getVersion(framework) < 9: interfaceIndexOsh = createInterfaceIndexOsh(physAdapt, hostOsh) if interfaceIndexOsh: linkOsh = modeling.createLinkOSH('parent', interfaceIndexOsh, physAdaptOsh) vector.add(interfaceIndexOsh) vector.add(linkOsh) # vector.add(physAdaptOsh) ethAdaptersDict[physAdapt.name] = physAdaptOsh if linkAggrAdaptList: for linkAggr in linkAggrAdaptList: linkAggrOsh = createLinkAggrOsh(linkAggr, hostOsh) if linkAggr.usedAdapters: vector.add(linkAggrOsh) ethAdaptersDict[linkAggr.name] = linkAggrOsh for usedAdapterName in linkAggr.usedAdapters: physAdaptOsh = ethAdaptersDict.get(usedAdapterName) if physAdaptOsh: #change the KEY attribute for the Physical Ethernet Adapter mac = physAdaptOsh.getAttributeValue( 'interface_macaddr') newKey = '%s_%s' % (mac, usedAdapterName) physAdaptOsh.setAttribute('interface_macaddr', newKey) ethAdaptersDict[usedAdapterName] = physAdaptOsh linkOsh = modeling.createLinkOSH( 'member', linkAggrOsh, physAdaptOsh) vector.add(linkOsh) if linkAggr.backupAdapter: ethBackOsh = ethAdaptersDict.get(linkAggr.backupAdapter) linkOsh = modeling.createLinkOSH('member', linkAggrOsh, ethBackOsh) vector.add(linkOsh) #Adding Physical ETH adapters to the result vector if ethAdaptersDict: for physAdaptOsh in ethAdaptersDict.values(): vector.add(physAdaptOsh) if seaAdaptList: for seaAdapter in seaAdaptList: seaAdapterOsh = createSeaOsh(seaAdapter, hostOsh) if seaAdapter.usedAdapters: vector.add(seaAdapterOsh) ethAdaptersDict[seaAdapter.name] = seaAdapterOsh for usedAdapterName in seaAdapter.usedAdapters: backAdapterOsh = ethAdaptersDict.get(usedAdapterName) if backAdapterOsh: linkOsh = modeling.createLinkOSH( 'use', seaAdapterOsh, backAdapterOsh) vector.add(linkOsh) if virtAdaptList: for virtualAdapter in virtAdaptList: virtAdapterOsh = ibm_hmc_lib.createVEthOsh(virtualAdapter, hostOsh) vector.add(virtAdapterOsh) if ethAliasesList: for aliasName in [ 'en' + str(virtualAdapter.interfaceIndex), 'et' + str(virtualAdapter.interfaceIndex) ]: if aliasName in ethAliasesList: aliasOsh = createAliasOsh(aliasName, hostOsh, virtualAdapter) if aliasOsh: vector.add(aliasOsh) vector.add( vector.add( modeling.createLinkOSH( 'realization', virtAdapterOsh, aliasOsh))) if virtualAdapter.usedAdapters: for usedAdapterName in virtualAdapter.usedAdapters: backAdapterOsh = ethAdaptersDict.get(usedAdapterName) if backAdapterOsh: linkOsh = modeling.createLinkOSH( 'use', virtAdapterOsh, backAdapterOsh) vector.add(linkOsh) if virtualAdapter.physicalPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = virtualAdapter.physicalPath ioSlot.drcName = virtualAdapter.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName( ioSlot.drcName) if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh( ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, virtAdapterOsh) vector.add(ioSlotOsh) vector.add(linkOsh) if fiberChannelAdaptersList: for fiberChannelAdapter in fiberChannelAdaptersList: fiberChannelOsh = createFiberChannelOsh(fiberChannelAdapter, managedSystemOsh) vector.add(fiberChannelOsh) linkOsh = modeling.createLinkOSH('contained', hostOsh, fiberChannelOsh) vector.add(linkOsh) if fiberChannelAdapter.physPath: ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = fiberChannelAdapter.physPath ioSlot.drcName = fiberChannelAdapter.physPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName( ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh( ioSlot, managedSystemOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, fiberChannelOsh) vector.add(ioSlotOsh) vector.add(linkOsh) #create Storage Topology vector.addAll( storage_topology.createStorageTopology(volumeGroupsDict.values(), logicalVolumeDict.values(), physicalVolumeDict.values(), scsiAdaptersList, hostOsh)) if scsiManList and pvAssignList: pScsiDict = {} for scsi in scsiManList: scsiOsh = None ioSlot = ibm_hmc_lib.IoSlot() ioSlot.name = scsi.physicalPath ioSlot.drcName = scsi.physicalPath ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName( ioSlot.drcName) ioSlotOsh = None if isPhysicalSlot(ioSlot): ioSlotOsh = ibm_hmc_lib.createIoSlotOsh( ioSlot, managedSystemOsh) scsiOsh = storage_topology.createScsiAdapterOsh( scsi, managedSystemOsh) linkOsh = modeling.createLinkOSH('contained', hostOsh, scsiOsh) vector.add(linkOsh) else: ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh) scsiOsh = storage_topology.createScsiAdapterOsh(scsi, hostOsh) vector.add(scsiOsh) pScsiDict[scsi.slotNumber] = scsiOsh linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, scsiOsh) vector.add(ioSlotOsh) vector.add(linkOsh) for pv in pvAssignList: pvOsh = storage_topology.createPhysicalVolumeOsh(pv, hostOsh) scsiOsh = pScsiDict.get(pv.scsiAdapterSlotNumber) if pvOsh and scsiOsh: vector.add(pvOsh) linkOsh = modeling.createLinkOSH("depend", pvOsh, scsiOsh) vector.add(linkOsh) return vector