コード例 #1
0
ファイル: api.py プロジェクト: GluonsAndProtons/gluon-nova
    def _bind_port(self, port_id, zone, instance, pci_request_id):
        """Populate gluon binding:profile.

        Populate it with SR-IOV related information
        """
        LOG.info('In _bind_port')
        LOG.info('binding port %s' % port_id)
        pci_profile = None
        if pci_request_id:
            pci_dev = pci_manager.get_instance_pci_devs(
                instance, pci_request_id).pop()
            devspec = pci_whitelist.get_pci_device_devspec(pci_dev)
            pci_profile = {'pci_vendor_info': "%s:%s" % (pci_dev.vendor_id,
                                                         pci_dev.product_id),
                           'pci_slot': pci_dev.address,
                           'physical_network':
                               devspec.get_tags().get('physical_network')
                           }

        # These are used by Neutron extensions and could be used by other
        # things...
        flavor = instance.get_flavor()
        rxtx_factor = flavor.get('rxtx_factor')

        host = instance.get('host')

        self.client.bind(port_id, zone, instance.uuid, host, pci_profile=pci_profile, rxtx_factor=rxtx_factor)
コード例 #2
0
    def _bind_port(self, port_id, zone, instance, pci_request_id):
        """Populate gluon binding:profile.

        Populate it with SR-IOV related information
        """
        LOG.error('binding port %s' % port_id)
        pci_profile = None
        if pci_request_id:
            pci_dev = pci_manager.get_instance_pci_devs(
                instance, pci_request_id).pop()
            devspec = pci_whitelist.get_pci_device_devspec(pci_dev)
            pci_profile = {
                'pci_vendor_info':
                "%s:%s" % (pci_dev.vendor_id, pci_dev.product_id),
                'pci_slot':
                pci_dev.address,
                'physical_network':
                devspec.get_tags().get('physical_network')
            }

# These are used by Neutron extensions and could be used by other
# things...
        flavor = instance.get_flavor()
        rxtx_factor = flavor.get('rxtx_factor')

        host = instance.get('host')

        self.client.bind(port_id,
                         zone,
                         instance.uuid,
                         host,
                         pci_profile=pci_profile,
                         rxtx_factor=rxtx_factor)
コード例 #3
0
ファイル: stats.py プロジェクト: ruslanloman/nova
    def _create_pool_keys_from_dev(self, dev):
        """create a stats pool dict that this dev is supposed to be part of

        Note that this pool dict contains the stats pool's keys and their
        values. 'count' and 'devices' are not included.
        """
        # Don't add a device that doesn't have a matching device spec.
        # This can happen during initial sync up with the controller
        devspec = whitelist.get_pci_device_devspec(dev)
        if not devspec:
            return
        tags = devspec.get_tags()
        pool = {k: getattr(dev, k) for k in self.pool_keys}
        if tags:
            pool.update(tags)
        return pool
コード例 #4
0
ファイル: stats.py プロジェクト: stanleykao72/nova
    def _create_pool_keys_from_dev(self, dev):
        """create a stats pool dict that this dev is supposed to be part of

        Note that this pool dict contains the stats pool's keys and their
        values. 'count' and 'devices' are not included.
        """
        # Don't add a device that doesn't have a matching device spec.
        # This can happen during initial sync up with the controller
        devspec = whitelist.get_pci_device_devspec(dev)
        if not devspec:
            return
        tags = devspec.get_tags()
        pool = {k: dev.get(k) for k in self.pool_keys}
        if tags:
            pool.update(tags)
        return pool