diff options
author | Phil Day <philip.day@hp.com> | 2012-07-11 09:26:11 +0100 |
---|---|---|
committer | Phil Day <philip.day@hp.com> | 2012-07-12 16:15:39 +0100 |
commit | 34f9d7e974d0e09c723e0a04ed6eecd1b482e77d (patch) | |
tree | 23e1f85bbae6993342c49af44294c6137ca531fe | |
parent | 74a7294cf68ad64367620caac52c7670d6d379ca (diff) | |
download | nova-34f9d7e974d0e09c723e0a04ed6eecd1b482e77d.tar.gz nova-34f9d7e974d0e09c723e0a04ed6eecd1b482e77d.tar.xz nova-34f9d7e974d0e09c723e0a04ed6eecd1b482e77d.zip |
Convert remaining network API casts to calls
Fix for Bug 1021340
During compute/terminate_instance networking is de-allocated by a call to
network/api/deallocate_for_instance(), which is implemented as an rpc.cast to
the network manager. This in turn will eventually call
network/manager/deallocate_fixed_ip(), which in turn call the compute API to
trigger a security group refresh, which will get the instance from the database
However because original call to the network manager is a cast there is a chance
that the compute manager will delete the instance record in the DB before the
compute API (in the network manager) tries to retrieve the instance. At this
point the security group refresh fails (leaving rules in place which are a
security risk when the IP is reused), and potentially stopping otheraspects
of the network deallocation from completing.
Changing this from rpc.call to rpc.cast will fix this issue.
Aside from this specific use of a cast there are 4 other casts in the
network API:
add_fixed_ip_to_instance
remove_fixed_ip_from_instance
add_network_to_project
release_floating_ip
and to avoid other timing issues these will also be converted to calls.
Change-Id: I5cdcc628293d3e7cf165c5ffe4883f138783f73f
-rw-r--r-- | nova/network/api.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nova/network/api.py b/nova/network/api.py index 6a5c151da..afedb3d90 100644 --- a/nova/network/api.py +++ b/nova/network/api.py @@ -175,7 +175,7 @@ class API(base.Base): def release_floating_ip(self, context, address, affect_auto_assigned=False): """Removes floating ip with address from a project. (deallocates)""" - rpc.cast(context, + rpc.call(context, FLAGS.network_topic, {'method': 'deallocate_floating_ip', 'args': {'address': address, @@ -230,7 +230,7 @@ class API(base.Base): args['instance_id'] = instance['id'] args['project_id'] = instance['project_id'] args['host'] = instance['host'] - rpc.cast(context, FLAGS.network_topic, + rpc.call(context, FLAGS.network_topic, {'method': 'deallocate_for_instance', 'args': args}) @@ -239,7 +239,7 @@ class API(base.Base): args = {'instance_id': instance['id'], 'host': instance['host'], 'network_id': network_id} - rpc.cast(context, FLAGS.network_topic, + rpc.call(context, FLAGS.network_topic, {'method': 'add_fixed_ip_to_instance', 'args': args}) @@ -249,13 +249,13 @@ class API(base.Base): args = {'instance_id': instance['id'], 'host': instance['host'], 'address': address} - rpc.cast(context, FLAGS.network_topic, + rpc.call(context, FLAGS.network_topic, {'method': 'remove_fixed_ip_from_instance', 'args': args}) def add_network_to_project(self, context, project_id): """Force adds another network to a project.""" - rpc.cast(context, FLAGS.network_topic, + rpc.call(context, FLAGS.network_topic, {'method': 'add_network_to_project', 'args': {'project_id': project_id}}) |