diff options
author | Artom Lifshitz <alifshit@redhat.com> | 2021-03-04 09:41:51 -0500 |
---|---|---|
committer | Artom Lifshitz <alifshit@redhat.com> | 2021-03-08 15:18:46 -0500 |
commit | 6c3175d3ee8ffe323630f57655318ba3da9fe8b5 (patch) | |
tree | a7ced5992ac0e86acfa57b5b611afd59d25e9444 /nova/pci | |
parent | dc6667c2112350cd62b20eb4a4d93f251005620f (diff) | |
download | nova-6c3175d3ee8ffe323630f57655318ba3da9fe8b5.tar.gz |
pci manager: replace node_id parameter with compute_node
To implement the `socket` PCI NUMA affinity policy, we'll need to
track the host NUMA topology in the PCI stats code. To achieve this,
PCI stats will need to know the compute node it's running on. Prepare
for this by replacing the node_id parameter with compute_node. Node_id
was previously optional, but that looks to have been only to
facilitate testing, as that's the only place where it was not passed
it. We use compute_node (instead of just making node_id mandatory)
because it allows for an optimization later on wherein the PCI manager
does not need to pull the ComputeNode object from the database
needlessly.
Implements: blueprint pci-socket-affinity
Change-Id: Idc839312d1449e9327ee7e3793d53ed080a44d0c
Diffstat (limited to 'nova/pci')
-rw-r--r-- | nova/pci/manager.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/nova/pci/manager.py b/nova/pci/manager.py index 0c823934fa..acf712f3d5 100644 --- a/nova/pci/manager.py +++ b/nova/pci/manager.py @@ -51,25 +51,22 @@ class PciDevTracker(object): are saved. """ - def __init__(self, context, node_id=None): + def __init__(self, context, compute_node): """Create a pci device tracker. - If a node_id is passed in, it will fetch pci devices information - from database, otherwise, it will create an empty devices list - and the resource tracker will update the node_id information later. + :param context: The request context. + :param compute_node: The object.ComputeNode whose PCI devices we're + tracking. """ super(PciDevTracker, self).__init__() self.stale = {} - self.node_id = node_id + self.node_id = compute_node.id self.dev_filter = whitelist.Whitelist(CONF.pci.passthrough_whitelist) self.stats = stats.PciDeviceStats(dev_filter=self.dev_filter) self._context = context - if node_id: - self.pci_devs = objects.PciDeviceList.get_by_compute_node( - context, node_id) - else: - self.pci_devs = objects.PciDeviceList(objects=[]) + self.pci_devs = objects.PciDeviceList.get_by_compute_node( + context, self.node_id) self._build_device_tree(self.pci_devs) self._initial_instance_usage() |