summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authordeevi rani <deevi_rani@persistent.co.in>2012-05-03 06:42:47 -0400
committerVishvananda Ishaya <vishvananda@gmail.com>2012-06-14 20:40:40 +0000
commit7097e01a15ecd5c28b6b771e5043f18da243607e (patch)
tree541223b6f1d8d48323ec809e30c3fe424b5127ed /nova
parentaa1e71d1b313f80f5581b1422e3f3e5719569e50 (diff)
Updates the cache
fixes bug 939122 Following are the changes done: 1. in compute/api.py to display the floating ip in nova list command upon its association with an instance. 2. in network/api.py to solve the similar issue upon the floating ip disassocaition Updated version of: https://review.openstack.org/#/c/7059 Change-Id: Ief1a3f544c3d14bd61cc0814612df3ee521ddec2
Diffstat (limited to 'nova')
-rw-r--r--nova/compute/api.py2
-rw-r--r--nova/network/api.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 922a8bace..1e28f0190 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1623,6 +1623,8 @@ class API(base.Base):
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):
diff --git a/nova/network/api.py b/nova/network/api.py
index ecef022bc..715d054d5 100644
--- a/nova/network/api.py
+++ b/nova/network/api.py
@@ -146,10 +146,18 @@ class API(base.Base):
def disassociate_floating_ip(self, context, address,
affect_auto_assigned=False):
"""Disassociates a floating ip from fixed ip it is associated with."""
+ floating_ip = self.db.floating_ip_get_by_address(context, address)
+ fixed_ip = self.db.fixed_ip_get(context, floating_ip['fixed_ip_id'])
+ instance = self.db.instance_get(context, fixed_ip['instance_id'])
rpc.cast(context,
FLAGS.network_topic,
{'method': 'disassociate_floating_ip',
'args': {'address': address}})
+ self.invalidate_instance_cache(context, instance)
+
+ def invalidate_instance_cache(self, context, instance):
+ # NOTE(vish): get_instance_nw_info will recreate the cache for us
+ self.get_instance_nw_info(context, instance)
def allocate_for_instance(self, context, instance, **kwargs):
"""Allocates all network structures for an instance.