From 46690df48392c8967fc4f0ea05b5dba152fa400a Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Tue, 5 Jul 2011 13:24:31 -0700 Subject: copy paste --- nova/compute/api.py | 10 ++++++++-- nova/compute/manager.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'nova/compute') 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 @@ -840,6 +840,20 @@ class ComputeManager(manager.SchedulerDependentManager): self.inject_network_info(context, instance_id) self.reset_network(context, instance_id) + @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): -- cgit