Ejemplo n.º 1
0
    def _update_host_pci_whitelist(self, host, pci_config):
        """
        Generate multistring values containing PCI passthrough
        and SR-IOV devices.

        The multistring type with list of JSON string values is used
        to generate one-line-per-entry pretty formatting.
        """
        # obtain interface information specific to this host
        iface_context = {
            'ports':
            interface._get_port_interface_id_index(self.dbapi, host),
            'interfaces':
            interface._get_interface_name_index(self.dbapi, host),
            'interfaces_datanets':
            interface._get_interface_name_datanets(self.dbapi, host),
            'addresses':
            interface._get_address_interface_name_index(self.dbapi, host),
        }

        # This host's list of PCI passthrough and SR-IOV device dictionaries
        devices = []
        devices.extend(self._get_pci_pt_whitelist(host, iface_context))
        devices.extend(self._get_pci_sriov_whitelist(host, iface_context))
        if not devices:
            return

        # Convert device list into passthrough_whitelist multistring
        multistring = self._oslo_multistring_override(
            name='passthrough_whitelist', values=devices)
        if multistring is not None:
            pci_config.update(multistring)
Ejemplo n.º 2
0
 def _get_address_interface_name_index(self, host):
     """
     Builds a dictionary of address lists indexed by interface name.
     """
     return interface._get_address_interface_name_index(self.dbapi, host)