You don't need to update the port.device_id to be '', nova will do that for ports it didn't create. By wiping those out before deleting the instance, nova can't find the ports to unbind/delete here:
https://github.com/openstack/nova/blob/b790332f227411a16049f841c68292a7b0b88d81/nova/network/neutronv2/api.py#L1064
But nova should still be deleting the virtual interface records for the given instance here:
https://github.com/openstack/nova/blob/b790332f227411a16049f841c68292a7b0b88d81/nova/network/neutronv2/api.py#L1091
You don't need to update the port.device_id to be '', nova will do that for ports it didn't create. By wiping those out before deleting the instance, nova can't find the ports to unbind/delete here:
https:/ /github. com/openstack/ nova/blob/ b790332f227411a 16049f841c68292 a7b0b88d81/ nova/network/ neutronv2/ api.py# L1064
But nova should still be deleting the virtual interface records for the given instance here:
https:/ /github. com/openstack/ nova/blob/ b790332f227411a 16049f841c68292 a7b0b88d81/ nova/network/ neutronv2/ api.py# L1091