summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-27 11:58:19 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-30 16:58:24 -0400
commit96134f9e34faf7e4be1776b24c8d8d661a23342a (patch)
treec4bbc4539eea23c198c454a8c576e7126005f4cd /nova/compute
parent0e16133db77b434f8dc5b298ef8166aa05013630 (diff)
Send a full instance in remove_fixed_ip_from_instance.
Change the remove_fixed_ip_from_instance method of the compute rpc API to take a full instance over rpc instead of just the instance UUID. This cuts down on database access needed by nova-compute. Part of blueprint no-db-messaging. Change-Id: Iee0daf068be9814ef0ba06a69111a45a2e198cbb
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py18
-rw-r--r--nova/compute/rpcapi.py8
2 files changed, 16 insertions, 10 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index b2c9b86f4..ef46b17b6 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -272,7 +272,7 @@ def _get_image_meta(context, image_ref):
class ComputeManager(manager.SchedulerDependentManager):
"""Manages the running instances from creation to destruction."""
- RPC_API_VERSION = '1.24'
+ RPC_API_VERSION = '1.25'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -1687,25 +1687,27 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
@wrap_instance_fault
- def remove_fixed_ip_from_instance(self, context, instance_uuid, address):
+ def remove_fixed_ip_from_instance(self, context, address, instance=None,
+ instance_uuid=None):
"""Calls network_api to remove existing fixed_ip from instance
by injecting the altered network info and resetting
instance networking.
"""
- instance_ref = self.db.instance_get_by_uuid(context, instance_uuid)
+ if not instance:
+ instance = self.db.instance_get_by_uuid(context, instance_uuid)
self._notify_about_instance_usage(
- context, instance_ref, "delete_ip.start")
+ context, instance, "delete_ip.start")
self.network_api.remove_fixed_ip_from_instance(context,
- instance_ref,
+ instance,
address)
network_info = self._inject_network_info(context,
- instance=instance_ref)
- self.reset_network(context, instance_ref['uuid'])
+ instance=instance)
+ self.reset_network(context, instance['uuid'])
self._notify_about_instance_usage(
- context, instance_ref, "delete_ip.end", network_info=network_info)
+ context, instance, "delete_ip.end", network_info=network_info)
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@checks_instance_lock
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 11f95f749..70f3da64c 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -92,6 +92,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
pre_live_migration()
1.24 - Remove instance_uuid, add instance argument to
rebuild_instance()
+ 1.25 - Remove instance_uuid, add instance argument to
+ remove_fixed_ip_from_instance()
'''
BASE_RPC_API_VERSION = '1.0'
@@ -326,9 +328,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
topic=_compute_topic(self.topic, ctxt, host, None))
def remove_fixed_ip_from_instance(self, ctxt, instance, address):
+ instance_p = jsonutils.to_primitive(instance)
self.cast(ctxt, self.make_msg('remove_fixed_ip_from_instance',
- instance_uuid=instance['uuid'], address=address),
- topic=_compute_topic(self.topic, ctxt, None, instance))
+ instance=instance_p, address=address),
+ topic=_compute_topic(self.topic, ctxt, None, instance),
+ version='1.25')
def remove_volume_connection(self, ctxt, instance, volume_id, host):
return self.call(ctxt, self.make_msg('remove_volume_connection',