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
This commit is contained in:
Russell Bryant
2012-10-01 01:21:07 +01:00
parent 9b71dd42b6
commit 63e41eb293

View File

@@ -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):