diff options
author | Balazs Gibizer <gibi@redhat.com> | 2022-08-30 12:21:12 +0200 |
---|---|---|
committer | Balazs Gibizer <gibi@redhat.com> | 2022-09-02 14:07:32 +0200 |
commit | 11bcf2676c326451772a7280b45180882d5dc9a7 (patch) | |
tree | c1e0f654b12e981fa10e3f11821351ede3ce20c5 | |
parent | ccab6fed463337c029459469c76e92af3b96fa06 (diff) | |
download | nova-11bcf2676c326451772a7280b45180882d5dc9a7.tar.gz |
Follow up for the PCI in placement series
Fixed various small issues from the already merged (or being merged)
patches.
The logic behind the dropped FIXME and empty condition are handled in
the update_allocations() calls of the translator already.
The removal of excutils.save_and_reraise_exception from the report
client is safe as self._clear_provider_cache_for_tree does not raise.
blueprint: pci-device-tracking-in-placement
Change-Id: If87dedc6a14f7b116c4238e7534b67574428c01c
-rw-r--r-- | nova/compute/pci_placement_translator.py | 10 | ||||
-rw-r--r-- | nova/objects/instance.py | 4 | ||||
-rw-r--r-- | nova/scheduler/client/report.py | 4 | ||||
-rw-r--r-- | nova/tests/unit/compute/test_resource_tracker.py | 2 |
4 files changed, 5 insertions, 15 deletions
diff --git a/nova/compute/pci_placement_translator.py b/nova/compute/pci_placement_translator.py index 5a1a060d76..d6d7fdd6f1 100644 --- a/nova/compute/pci_placement_translator.py +++ b/nova/compute/pci_placement_translator.py @@ -401,16 +401,6 @@ class PlacementView: } raise exception.PlacementPciException(error=msg) - if 'instance_uuid' in dev and dev.instance_uuid: - # The device is allocated to an instance, so we need to make sure - # the device will be allocated to the instance in placement too - # FIXME(gibi): During migration the source host allocation should - # be tight to the migration_uuid as consumer in placement. But - # the PciDevice.instance_uuid is still pointing to the - # instance_uuid both on the source and the dest. So we need to - # check for running migrations. - pass - def _remove_child(self, dev: pci_device.PciDevice) -> None: rp_name = self._get_rp_name_for_child(dev) self._ensure_rp(rp_name).remove_child(dev) diff --git a/nova/objects/instance.py b/nova/objects/instance.py index 0bdf4af31e..fed1a7c58b 100644 --- a/nova/objects/instance.py +++ b/nova/objects/instance.py @@ -1245,8 +1245,8 @@ class Instance(base.NovaPersistentObject, base.NovaObject, # return early to avoid an extra lazy load on self.pci_requests # if there are no devices allocated to be filtered return [] - else: - devs = self.pci_devices.objects + + devs = self.pci_devices.objects if request_id is not None: devs = [dev for dev in devs if dev.request_id == request_id] diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py index 2896a07f13..1242752be1 100644 --- a/nova/scheduler/client/report.py +++ b/nova/scheduler/client/report.py @@ -1391,8 +1391,8 @@ class SchedulerReportClient(object): # the conflict exception. This signals the resource tracker to # redrive the update right away rather than waiting until the # next periodic. - with excutils.save_and_reraise_exception(): - self._clear_provider_cache_for_tree(rp_uuid) + self._clear_provider_cache_for_tree(rp_uuid) + raise except helper_exceptions: # Invalidate the relevant part of the cache. It gets rebuilt on # the next pass. diff --git a/nova/tests/unit/compute/test_resource_tracker.py b/nova/tests/unit/compute/test_resource_tracker.py index a3b005b80f..b81d7365d2 100644 --- a/nova/tests/unit/compute/test_resource_tracker.py +++ b/nova/tests/unit/compute/test_resource_tracker.py @@ -1973,7 +1973,7 @@ class TestUpdateComputeNode(BaseTestCase): """Assert that if the pci placement reporting code tries to remove inventory with allocation from placement due to invalid hypervisor or [pci]device_spec reconfiguration then the InventoryInUse error from - placement is propagated and makes the compute startup to fail. + placement is propagated and makes the compute startup fail. """ compute_obj = _COMPUTE_NODE_FIXTURES[0].obj_clone() self._setup_rt() |