def _populate_pci_mac_address(self, container, pci_request_id, port_req_body): """Add the updated MAC address value to the update_port request body. Currently this is done only for PF passthrough. """ if pci_request_id is not None: pci_devs = pci_manager.get_container_pci_devs( container, pci_request_id) if len(pci_devs) != 1: # NOTE(ndipanov): We shouldn't ever get here since # InstancePCIRequest instances built from network requests # only ever index a single device, which needs to be # successfully claimed for this to be called as part of # allocate_networks method LOG.error("PCI request %(pci_request_id)s does not have a " "unique device associated with it. Unable to " "determine MAC address", {'pci_request_id': pci_request_id}, container=container) return pci_dev = pci_devs[0] if pci_dev.dev_type == obj_fields.PciDeviceType.SRIOV_PF: try: mac = pci_utils.get_mac_by_pci_address(pci_dev.address) except exception.PciDeviceNotFoundById as e: LOG.error("Could not determine MAC address for %(addr)s, " "error: %(e)s", {"addr": pci_dev.address, "e": e}, container=container) else: port_req_body['port']['mac_address'] = mac
def _populate_pci_mac_address(self, container, pci_request_id, port_req_body): """Add the updated MAC address value to the update_port request body. Currently this is done only for PF passthrough. """ if pci_request_id is not None: pci_devs = pci_manager.get_container_pci_devs( container, pci_request_id) if len(pci_devs) != 1: # NOTE(ndipanov): We shouldn't ever get here since # InstancePCIRequest instances built from network requests # only ever index a single device, which needs to be # successfully claimed for this to be called as part of # allocate_networks method LOG.error("PCI request %(pci_request_id)s does not have a " "unique device associated with it. Unable to " "determine MAC address", {'pci_request_id': pci_request_id}, container=container) return pci_dev = pci_devs[0] if pci_dev.dev_type == obj_fields.PciDeviceType.SRIOV_PF: try: mac = pci_utils.get_mac_by_pci_address(pci_dev.address) except exception.PciDeviceNotFoundById as e: LOG.error("Could not determine MAC address for %(addr)s, " "error: %(e)s", {"addr": pci_dev.address, "e": e}, container=container) else: port_req_body['port']['mac_address'] = mac
def _populate_neutron_binding_profile(self, container, pci_request_id, port_req_body): """Populate neutron binding:profile. Populate it with SR-IOV related information """ if pci_request_id: pci_dev = pci_manager.get_container_pci_devs( container, pci_request_id).pop() profile = self._get_pci_device_profile(pci_dev) port_req_body['port'][consts.BINDING_PROFILE] = profile
def _populate_neutron_binding_profile(self, container, pci_request_id, port_req_body): """Populate neutron binding:profile. Populate it with SR-IOV related information """ if pci_request_id: pci_dev = pci_manager.get_container_pci_devs( container, pci_request_id).pop() profile = self._get_pci_device_profile(pci_dev) port_req_body['port'][BINDING_PROFILE] = profile