diff options
| author | Trey Morris <treyemorris@gmail.com> | 2012-06-15 16:35:31 -0500 |
|---|---|---|
| committer | Trey Morris <treyemorris@gmail.com> | 2012-06-18 13:31:56 -0500 |
| commit | 82599c77346bbefd550ea4ee6c0b13a3df4950af (patch) | |
| tree | 5178e194b41705fc264eca182cebe42535ff83a7 /nova/compute | |
| parent | 4d9545260509d238e7ba809d39b3a4e602f5777b (diff) | |
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
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 38 |
1 files changed, 0 insertions, 38 deletions
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 @@ -1589,44 +1589,6 @@ class API(base.Base): 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.""" rv = self.db.instance_metadata_get(context, instance['uuid']) |
