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 _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 get_fake_driver_attach_handle_objs(): attach_handles_list = get_fake_driver_attach_handles_as_dict() obj_attach_handles = [] for attach_handle in attach_handles_list: obj_driver_attach_handle = driver_attach_handle.DriverAttachHandle() for field in attach_handle.keys(): obj_driver_attach_handle[field] = attach_handle[field] obj_attach_handles.append(obj_driver_attach_handle) return obj_attach_handles
def _generate_attach_handles(self, pci, num_accelerators): """Returns list of attach handles, with same bus# but differing in device/function numbers. Assumes NUM_ACCELERATORS <= 256, otherwise bus# has to change too. """ # In PCI bus-device-function address, 1 device can have 8 functions. NUM_PCI_FN_PER_PCI_DEVICE = 8 ah_list = [] for fn in range(1, num_accelerators + 1): # fn 0 is CPID driver_ah = driver_attach_handle.DriverAttachHandle() # The virt driver will ignore this type when attaching driver_ah.attach_type = constants.AH_TYPE_TEST_PCI driver_ah.in_use = False pci_slot_dict = jsonutils.loads(pci['slot']) pci_slot_dict['device'] = str(int(fn / NUM_PCI_FN_PER_PCI_DEVICE)) pci_slot_dict['function'] = str(fn % NUM_PCI_FN_PER_PCI_DEVICE) pci_slot_str = jsonutils.dumps(pci_slot_dict) driver_ah.attach_info = pci_slot_str ah_list.append(driver_ah) return ah_list
def _generate_attach_handle(self, pci): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = "PCI" driver_ah.in_use = False driver_ah.attach_info = pci["slot_json"] return driver_ah
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(fpga, pf_has_vf): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = "pci" driver_ah.attach_info = 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
def _generate_attach_handle(gpu): driver_ah = driver_attach_handle.DriverAttachHandle() driver_ah.attach_type = "PCI" driver_ah.in_use = False driver_ah.attach_info = gpu["devices"] return driver_ah