def _generate_controlpath_id(gpu): driver_cpid = driver_controlpath_id.DriverControlPathID() # NOTE: GPUs (either pGPU or vGPU), they all report "PCI" as # their cpid_type, while attach_handle_type of them are different. driver_cpid.cpid_type = "PCI" driver_cpid.cpid_info = utils.pci_str_to_json(gpu["devices"]) return driver_cpid
def _generate_attach_handle(nic): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = "PCI" driver_ah.attach_info = utils.pci_str_to_json(nic["device"], nic["physical_network"]) driver_ah.in_use = False return driver_ah
def discover(self): """The PCI line would be matched as: 0000:0c:00.0 Processing acc [1200]: Device [19e5:d100] (rev 20) { 'slot': '0000:0c:00.0', # domain:bus:device.function 'device': 'Device', # Name of the device 'vendor_id': '19e5', # ID of the vendor 'class': 'Processing accelerators', # Name of the class 'device_id': 'd100', # ID of the device 'revision': '20' # Revision number } """ ascends = self._get_pci_lines(('d100',)) npu_list = [] for ascend in ascends: m = PCI_INFO_PATTERN.match(ascend) if m: pci_dict = m.groupdict() pci_dict["slot_json"] = utils.pci_str_to_json(pci_dict["slot"]) device = driver_device.DriverDevice() device.stub = False device.vendor = pci_dict["vendor_id"] device.model = pci_dict.get('model', '') std_board_info = {'device_id': pci_dict.get('device_id', None), 'class': pci_dict.get('class', None)} device.std_board_info = jsonutils.dumps(std_board_info) device.vendor_board_info = '' device.type = constants.DEVICE_AICHIP device.controlpath_id = self._generate_controlpath_id(pci_dict) device.deployable_list = self._generate_dep_list(pci_dict) npu_list.append(device) return npu_list
def _generate_attach_handle(gpu): driver_ah = driver_attach_handle.DriverAttachHandle() if gpu["rc"] == "PGPU": driver_ah.attach_type = constants.AH_TYPE_PCI else: driver_ah.attach_type = constants.AH_TYPE_MDEV driver_ah.in_use = False driver_ah.attach_info = utils.pci_str_to_json(gpu["devices"]) return driver_ah
def _generate_controlpath_id(nic): driver_cpid = driver_controlpath_id.DriverControlPathID() driver_cpid.cpid_type = "PCI" driver_cpid.cpid_info = utils.pci_str_to_json(nic["device"]) return driver_cpid
def _generate_attach_handle(fpga): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = constants.AH_TYPE_PCI driver_ah.attach_info = utils.pci_str_to_json(fpga["devices"]) driver_ah.in_use = False return driver_ah
def _generate_attach_handle(qat): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = "PCI" driver_ah.attach_info = utils.pci_str_to_json(qat["device"]) driver_ah.in_use = False return driver_ah