From 6fd9cd853dcc3bbf95fbf5833e95ca0928e76c6a Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Mon, 1 Oct 2012 01:21:07 +0100 Subject: [PATCH] Add version to network rpc API. This patch adds versioning support for the nova-network rpc API. During Folsom development I added versioning to all rpc APIs with the exception of network and volume. I was holding off on those to see what the fate of that code in nova was going to be for sure. Adding it to the volume API in nova doesn't make much sense at this point (but doing it in Cinder does). Since nova-network is sticking around for a while, it seems worthwhile to add a version number to the API for any future changes while the code is still in the tree. There are plenty of things in this rpc API that could be cleaned up or improved, but I held off on doing any of those things. I would recommend the same for anyone else (unless it's a bug that needs to be fixed). I think any further improvements should be focused on Quantum integration with Nova or Quantum itself. Fixes bug 1060197. Change-Id: I63ce57657388166544202af9c44c2298ae551aea --- bin/nova-dhcpbridge | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge index 0693ae27a..114dee268 100755 --- a/bin/nova-dhcpbridge +++ b/bin/nova-dhcpbridge @@ -39,6 +39,7 @@ from nova import context from nova import db from nova import flags from nova.network import linux_net +from nova.network import rpcapi as network_rpcapi from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import rpc @@ -57,10 +58,8 @@ def add_lease(mac, ip_address): network_manager.lease_fixed_ip(context.get_admin_context(), ip_address) else: - rpc.cast(context.get_admin_context(), - "%s.%s" % (FLAGS.network_topic, FLAGS.host), - {"method": "lease_fixed_ip", - "args": {"address": ip_address}}) + api = network_rpcapi.NetworkAPI() + api.lease_fixed_ip(context.get_admin_context(), ip_address, FLAGS.host) def old_lease(mac, ip_address): @@ -79,10 +78,9 @@ def del_lease(mac, ip_address): network_manager.release_fixed_ip(context.get_admin_context(), ip_address) else: - rpc.cast(context.get_admin_context(), - "%s.%s" % (FLAGS.network_topic, FLAGS.host), - {"method": "release_fixed_ip", - "args": {"address": ip_address}}) + api = network_rpcapi.NetworkAPI() + api.release_fixed_ip(context.get_admin_context(), ip_address, + FLAGS.host) def init_leases(network_id):