def _populate_neutron_extension_values(self, context, instance,
                                           pci_request_id, port_req_body,
                                           network=None, neutron=None,
                                           bind_host_id=None):
        """Populate neutron extension values for the instance.

        If the extensions loaded contain QOS_QUEUE then pass the rxtx_factor.
        """
        self._refresh_neutron_extensions_cache(context, neutron=neutron)
        if constants.QOS_QUEUE in self.extensions:
            flavor = instance.get_flavor()
            rxtx_factor = flavor.get('rxtx_factor')
            port_req_body['port']['rxtx_factor'] = rxtx_factor
        has_port_binding_extension = (
            self._has_port_binding_extension(context, neutron=neutron))
        if has_port_binding_extension:
            port_req_body['port']['binding:host_id'] = bind_host_id
            self._populate_neutron_binding_profile(instance,
                                                   pci_request_id,
                                                   port_req_body)
        if constants.DNS_INTEGRATION in self.extensions:
            # If the DNS integration extension is enabled in Neutron, most
            # ports will get their dns_name attribute set in the port create or
            # update requests in allocate_for_instance. So we just add the
            # dns_name attribute to the payload of those requests. The
            # exception is when the port binding extension is enabled in
            # Neutron and the port is on a network that has a non-blank
            # dns_domain attribute. This case requires to be processed by
            # method _update_port_dns_name
            if (not has_port_binding_extension
                or not network.get('dns_domain')):
                port_req_body['port']['dns_name'] = instance.hostname
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/network/neutronv2/api.py/API._populate_neutron_extension_values/original