summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorSandy Walsh <sandy.walsh@rackspace.com>2011-07-05 13:24:31 -0700
committerSandy Walsh <sandy.walsh@rackspace.com>2011-07-05 13:24:31 -0700
commit46690df48392c8967fc4f0ea05b5dba152fa400a (patch)
tree09e3446ecd3055ce3069fbc6f5fd329e6823c614 /nova/compute
parent6843421be9cdef1fc12d3480889bdcfd96821e1b (diff)
downloadnova-46690df48392c8967fc4f0ea05b5dba152fa400a.tar.gz
nova-46690df48392c8967fc4f0ea05b5dba152fa400a.tar.xz
nova-46690df48392c8967fc4f0ea05b5dba152fa400a.zip
copy paste
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py10
-rw-r--r--nova/compute/manager.py14
2 files changed, 22 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 28459dc75..a17ab2e1c 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -889,8 +889,14 @@ class API(base.Base):
def add_fixed_ip(self, context, instance_id, network_id):
"""Add fixed_ip from specified network to given instance."""
self._cast_compute_message('add_fixed_ip_to_instance', context,
- instance_id,
- network_id)
+ instance_id, network_id)
+
+ @scheduler_api.reroute_compute("remove_fixed_ip")
+ def remove_fixed_ip(self, context, instance_id, network_id):
+ """Remove fixed_ip from specified network to given instance."""
+ self._cast_compute_message('remove_fixed_ip_from_instance', context,
+ instance_id, network_id)
+
#TODO(tr3buchet): how to run this in the correct zone?
def add_network_to_project(self, context, project_id):
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index bbbddde0a..0f761c939 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -842,6 +842,20 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception
@checks_instance_lock
+ def remove_fixed_ip_from_instance(self, context, instance_id, network_id):
+ """Calls network_api to remove existing fixed_ip from instance
+ by injecting the altered network info and resetting
+ instance networking.
+
+ """
+ self.network_api.remove_fixed_ip_from_instance(context, instance_id,
+ network_id)
+ self.inject_network_info(context, instance_id)
+ self.reset_network(context, instance_id)
+
+
+ @exception.wrap_exception
+ @checks_instance_lock
def pause_instance(self, context, instance_id):
"""Pause an instance on this host."""
context = context.elevated()