Merge "Cleanup stale entries only after worker manifest"

This commit is contained in:
Zuul 2021-06-25 14:05:10 +00:00 committed by Gerrit Code Review
commit e4f71bb162
2 changed files with 16 additions and 2 deletions

View File

@ -726,9 +726,16 @@ class AgentManager(service.PeriodicService):
if pci_device_list: if pci_device_list:
try: try:
# Don't ask conductor to cleanup stale entries while worker
# manifest is not complete. For N3000 device, it could get rid
# of a valid entry with a different PCI address but restored
# from previous database backup
cleanup_stale = \
os.path.exists(tsc.VOLATILE_WORKER_CONFIG_COMPLETE)
rpcapi.pci_device_update_by_host(context, rpcapi.pci_device_update_by_host(context,
host_uuid, host_uuid,
pci_device_list) pci_device_list,
cleanup_stale)
self._inventory_reported.add(self.PCI_DEVICE) self._inventory_reported.add(self.PCI_DEVICE)
except exception.SysinvException: except exception.SysinvException:
LOG.exception("Sysinv Agent exception updating pci_device.") LOG.exception("Sysinv Agent exception updating pci_device.")

View File

@ -532,10 +532,17 @@ class FpgaAgentManager(service.PeriodicService):
if pci_device_list: if pci_device_list:
LOG.info("reporting N3000 PCI devices for host %s: %s" % LOG.info("reporting N3000 PCI devices for host %s: %s" %
(host_uuid, pci_device_list)) (host_uuid, pci_device_list))
# Don't ask conductor to cleanup stale entries while worker
# manifest is not complete. For N3000 device, it could get rid
# of a valid entry with a different PCI address but restored
# from previous database backup
cleanup_stale = \
os.path.exists(tsc.VOLATILE_WORKER_CONFIG_COMPLETE)
rpcapi.pci_device_update_by_host(context, rpcapi.pci_device_update_by_host(context,
host_uuid, host_uuid,
pci_device_list, pci_device_list,
cleanup_stale=True) cleanup_stale)
except Exception: except Exception:
LOG.exception("Exception updating n3000 PCI devices, " LOG.exception("Exception updating n3000 PCI devices, "
"this will likely cause problems.") "this will likely cause problems.")