def _setup_pci_tracker(self, context, compute_node): if not self.pci_tracker: n_id = compute_node.uuid self.pci_tracker = pci_manager.PciDevTracker(context, node_id=n_id) dev_json = self.container_driver.get_pci_resources() self.pci_tracker.update_devices_from_compute_resources(dev_json) dev_pools_obj = self.pci_tracker.stats.to_device_pools_obj() compute_node.pci_device_pools = dev_pools_obj
def test_pcidev_tracker_create_no_nodeid(self, mock_get_cn): self.tracker = manager.PciDevTracker(self.fake_context) self.assertEqual(len(self.tracker.pci_devs), 0) self.assertFalse(mock_get_cn.called)
def test_pcidev_tracker_create_with_nodeid(self, mock_get_cn): self.tracker = manager.PciDevTracker(self.fake_context, node_id=1) mock_get_cn.assert_called_once_with(self.fake_context, 1)
def _create_tracker(self, fake_devs): self.fake_devs = fake_devs self.tracker = manager.PciDevTracker(self.fake_context, 1)