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
This commit is contained in:
Balazs Gibizer 2022-08-30 12:21:12 +02:00
parent ccab6fed46
commit 11bcf2676c
4 changed files with 5 additions and 15 deletions

View File

@ -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)

View File

@ -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]

View File

@ -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.

View File

@ -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()