Comment 2 for bug 939060

Revision history for this message
Vish Ishaya (vishvananda) wrote :

I discussed this a bit offline with the networking team. It seems a little challenging to do the correct implementation for essex, but here is the basic plan:

Notes below from Trey Morris:

we'll need to pull the network_setup functionality out of ip allocation/deallocation and add a callable trigger to that functionality to the network api. It looks like for allocate_ip the functionality is already split out into the _setup_network() function. We need to do something similar for deallocate_ip, like _teardown_network(), and create a setup_networks() function with a corresponding network_api call.

setup/unsetup_all could be optimized into one function with a default parameter, something like:

def setup_networks(self, context, teardown=False, **kwargs):
    if teardown:
        call_func = self._teardown_network
    else:
        call_func = self._setup_network

    *pull instance variables from kwargs*
     nw_info = self.get_instance_nw_info(instance_stuff...)
     for vif in nw_info:
         self.call_func(context, vif['network'])

The flow as I see it (from compute) would be
def live_migrate():
    self.network_api.setup_networks(instance, teardown=True)
    perform migrate as it was before
    self.network_api.setup_networks(instance)

allocate_fixed_ip would still call self._setup_network(context, network) and the single network would be configured just as it was before, and deallocate could do the same, only it would call self._teardown_network(context, network) instead of performing the teradown in-function.

My only addition might be that you would want to teardown the network on the old host after the migrate, which means you might have to pass the host in the call somewhere.

In the meantime the above patch will at least make things work.