Seems to me that a very brute force way to prevent deleting allocated pci device records would be to raise an exception here:
https://github.com/openstack/nova/blob/def4b17934a3b2cf783d0177d6a9632916dfd10f/nova/objects/pci_device.py#L244
If self.instance_uuid is not None. I don't know what is setting the PciDevice.status to REMOVED/DELETED in the stack but clearly it's wrong and we should guard against that.
Seems to me that a very brute force way to prevent deleting allocated pci device records would be to raise an exception here:
https:/ /github. com/openstack/ nova/blob/ def4b17934a3b2c f783d0177d6a963 2916dfd10f/ nova/objects/ pci_device. py#L244
If self.instance_uuid is not None. I don't know what is setting the PciDevice.status to REMOVED/DELETED in the stack but clearly it's wrong and we should guard against that.