From 82599c77346bbefd550ea4ee6c0b13a3df4950af Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Fri, 15 Jun 2012 16:35:31 -0500 Subject: moved update cache functionality to the network api previously the network manager get_instance_nw_info was responsible for updating the cache. This is to prevent calling that function in a confusing way. part 2 of this patch was fixing bug997763 floating_ip_associate was removed from the compute api. network api associate is now called directly. network api floating_ip functions now require instance as an argument in order to update cache. Change-Id: Ie8daa017b99e48769afbac4862696ef0a8eb1067 --- nova/compute/api.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 1e28f0190..fc6a48725 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1588,44 +1588,6 @@ class API(base.Base): volume_id=volume_id) return instance - @wrap_check_policy - def associate_floating_ip(self, context, instance, address): - """Makes calls to network_api to associate_floating_ip. - - :param address: is a string floating ip address - """ - instance_uuid = instance['uuid'] - - # TODO(tr3buchet): currently network_info doesn't contain floating IPs - # in its info, if this changes, the next few lines will need to - # accommodate the info containing floating as well as fixed ip - # addresses - nw_info = self.network_api.get_instance_nw_info(context.elevated(), - instance) - - if not nw_info: - raise exception.FixedIpNotFoundForInstance( - instance_id=instance_uuid) - - ips = [ip for ip in nw_info[0].fixed_ips()] - - if not ips: - raise exception.FixedIpNotFoundForInstance( - instance_id=instance_uuid) - - # TODO(tr3buchet): this will associate the floating IP with the - # first fixed_ip (lowest id) an instance has. This should be - # changed to support specifying a particular fixed_ip if - # multiple exist. - if len(ips) > 1: - msg = _('multiple fixedips exist, using the first: %s') - LOG.warning(msg, ips[0]['address']) - - self.network_api.associate_floating_ip(context, - floating_address=address, fixed_address=ips[0]['address']) - self.network_api.invalidate_instance_cache(context.elevated(), - instance) - @wrap_check_policy def get_instance_metadata(self, context, instance): """Get all metadata associated with an instance.""" -- cgit