summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-30 21:59:56 +0000
committerGerrit Code Review <review@openstack.org>2012-07-30 21:59:56 +0000
commitd56b5fc3ad6dbfc56e0729174925fb146cef87fa (patch)
treede2fa52c66683f2d360c3e747588a010696da272
parent16b7e07066446bdafc778ccb6c723783f80c0452 (diff)
parent96134f9e34faf7e4be1776b24c8d8d661a23342a (diff)
downloadnova-d56b5fc3ad6dbfc56e0729174925fb146cef87fa.tar.gz
nova-d56b5fc3ad6dbfc56e0729174925fb146cef87fa.tar.xz
nova-d56b5fc3ad6dbfc56e0729174925fb146cef87fa.zip
Merge "Send a full instance in remove_fixed_ip_from_instance."
-rw-r--r--nova/compute/manager.py18
-rw-r--r--nova/compute/rpcapi.py8
-rw-r--r--nova/tests/compute/test_compute.py7
-rw-r--r--nova/tests/compute/test_rpcapi.py5
4 files changed, 22 insertions, 16 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 5a3dfa964..688b2317c 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."""
@@ -1679,25 +1679,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',
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index 701205417..fc2b183d9 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -888,13 +888,12 @@ class ComputeTestCase(BaseTestCase):
self.stubs.Set(nova.compute.manager.ComputeManager,
'reset_network', dummy)
- instance = self._create_fake_instance()
+ instance = jsonutils.to_primitive(self._create_fake_instance())
instance_uuid = instance['uuid']
self.assertEquals(len(test_notifier.NOTIFICATIONS), 0)
- self.compute.remove_fixed_ip_from_instance(self.context,
- instance_uuid,
- 1)
+ self.compute.remove_fixed_ip_from_instance(self.context, 1,
+ instance=instance)
self.assertEquals(len(test_notifier.NOTIFICATIONS), 2)
self.compute.terminate_instance(self.context, instance_uuid)
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index 79b33f25d..e081c1455 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -57,7 +57,8 @@ class ComputeRpcAPITestCase(test.TestCase):
'inject_file', 'inject_network_info', 'pause_instance',
'post_live_migration_at_destination', 'power_off_instance',
'power_on_instance', 'pre_live_migration', 'reboot_instance',
- 'rebuild_instance', 'start_instance', 'stop_instance',
+ 'rebuild_instance', 'remove_fixed_ip_from_instance',
+ 'start_instance', 'stop_instance',
'suspend_instance', 'unpause_instance'
]
@@ -257,7 +258,7 @@ class ComputeRpcAPITestCase(test.TestCase):
def test_remove_fixed_ip_from_instance(self):
self._test_compute_api('remove_fixed_ip_from_instance', 'cast',
- instance=self.fake_instance, address='addr')
+ instance=self.fake_instance, address='addr', version='1.25')
def test_remove_volume_connection(self):
self._test_compute_api('remove_volume_connection', 'call',