Comment 1 for bug 1759924

Revision history for this message
Matt Riedemann (mriedem) wrote :

I think this was the scenario described in IRC for this bug:

1. launch instance, it's in az zone-r7
2. shelve the instance
3. unshelve the instance - the scheduler now puts it in zone-r2
4. add a fixed IP to the instance

This fails because the addFixedIP flow is looking up ports for the instance by it's current zone and fails to find any because the ports still have the old zone in their device_owner field.

Looking at shelve offload, we could cleanup the device_owner and port binding information here:

https://github.com/openstack/nova/blob/144d621397c6a4065dec9773dc7441d9badc8f03/nova/compute/manager.py#L4837

That cleanup_instance_network_on_host method is currently just a no-op when using neutron.

If we look at unshelve, we call this method to update the port bindings for the host to point at the new host:

https://github.com/openstack/nova/blob/144d621397c6a4065dec9773dc7441d9badc8f03/nova/compute/manager.py#L4951

That gets into this code to change the port's binding:host_id value to the new host after the unshelve:

https://github.com/openstack/nova/blob/144d621397c6a4065dec9773dc7441d9badc8f03/nova/network/neutronv2/api.py#L2576

At that point, we likely should also change the device_owner on the port, like is done here:

https://github.com/openstack/nova/blob/144d621397c6a4065dec9773dc7441d9badc8f03/nova/network/neutronv2/api.py#L1031-L1033