def filterMemoryBlocks(self, memoryBlockList): "Removes reserved memory blocks and returns result" RESERVE_NAME = "reserved" result = [] print "Filtering memory blocks found..." filterlist = [memblock for memblock in memoryBlockList if memblock["name"] == "reserved"] result = util.removeListsFromList(memoryBlockList, filterlist) return result
def filterDevicePaths(self, devicePaths, devicecapmgr): "Returns filtered list of paths of devices" bridgePaths = [] pciExpressPaths = [] bridgedDevicePaths = [] nonPciExpressPaths = [] resultPaths = [] for devicepath in devicePaths: if self.isPciExpress(devicepath, devicecapmgr): pciExpressPaths.append(devicepath) if self.isBridge(devicepath): bridgePaths.append(devicepath) for root, subdirs, files in os.walk(devicepath): for subdir in subdirs: if self.isDeviceName(subdir): bridgedDevicePaths.append( os.path.join(root, subdir)) for bridgedDevice in bridgedDevicePaths: if self.isPciExpress(bridgedDevice, devicecapmgr) is False: nonPciExpressPaths.append(bridgedDevice) print "PCI Devices found: %d\n------------------" % len(devicePaths) print "> PCI Bridges: ", len(bridgePaths) for item in bridgePaths: print " ", os.path.basename(item) print "> Devices behind bridges: ", len(bridgedDevicePaths) for item in bridgedDevicePaths: print " ", os.path.basename(item) print "> PCI Express Devices: ", len(pciExpressPaths) for item in pciExpressPaths: print " ", os.path.basename(item) resultPaths = util.removeListsFromList(devicePaths, bridgePaths, nonPciExpressPaths) return resultPaths