[Openstack] FIXED IT! Re: Floating ip addresses take forever to display

Lars Kellogg-Stedman lars at seas.harvard.edu
Wed Nov 21 15:40:37 UTC 2012


>      compute.api.associate_floating_ip.  Do automatically assigned
>      addresses follow the same process as manually assigned ones?

The answer is NO!

- compute.manager._allocate_network calls:

    network_info = self.network_api.allocate_for_instance(
                        context, instance, vpn=is_vpn,
                        requested_networks=requested_networks)

...but as far as I can tell, this code path never calls
network.api.invalidate_instance_cache.

Adding a call to self.network_api.invalidate_instance_cache
immediately after the above call completely resolves this problem.

The actual ip assignment happens in
network.manager.FloatingIP.allocate_for_instance, which does this:

        if FLAGS.auto_assign_floating_ip:
            # allocate a floating ip
            floating_address = self.allocate_floating_ip(context, project_id)
            # set auto_assigned column to true for the floating ip
            self.db.floating_ip_set_auto_assigned(context, floating_address)

            # get the first fixed address belonging to the instance
            fixed_ips = nw_info.fixed_ips()
            fixed_address = fixed_ips[0]['address']

            # associate the floating ip to fixed_ip
            self.associate_floating_ip(context,
                                       floating_address,
                                       fixed_address,
                                       affect_auto_assigned=True)


Nothing in manager.py ever calls invalidate_instance_cache.

-- 
Lars Kellogg-Stedman <lars at seas.harvard.edu>  |
Senior Technologist                           | http://ac.seas.harvard.edu/
Academic Computing                            | http://code.seas.harvard.edu/
Harvard School of Engineering                 |
  and Applied Sciences                        |





More information about the Openstack mailing list