From ec3693a67baeb4e363d1b2f9f5a01c1032707495 Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 26 May 2011 18:13:04 -0500 Subject: updated the way allocate_for_instance and deallocate_for_instance handle kwargs --- nova/network/api.py | 2 ++ nova/network/manager.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/nova/network/api.py b/nova/network/api.py index 44b3c802b..9c66c8f6e 100644 --- a/nova/network/api.py +++ b/nova/network/api.py @@ -66,6 +66,8 @@ class API(base.Base): fixed_ip is either a fixed_ip object or a string fixed ip address floating_ip is a string floating ip address """ + # NOTE(tr3buchet): i don't like the "either or" argument type + # funcationility but i've left it alone for now if isinstance(fixed_ip, basestring): fixed_ip = self.db.fixed_ip_get_by_address(context, fixed_ip) floating_ip = self.db.floating_ip_get_by_address(context, floating_ip) diff --git a/nova/network/manager.py b/nova/network/manager.py index ba5b80522..3150eda01 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -345,9 +345,9 @@ class NetworkManager(manager.SchedulerDependentManager): rpc.called by network_api """ - instance_id = kwargs.get('instance_id') - project_id = kwargs.get('project_id') - type_id = kwargs.get('instance_type_id') + instance_id = kwargs.pop('instance_id') + project_id = kwargs.pop('project_id') + type_id = kwargs.pop('instance_type_id') admin_context = context.elevated() LOG.debug(_("network allocations for instance %s"), instance_id, context=context) @@ -364,7 +364,7 @@ class NetworkManager(manager.SchedulerDependentManager): rpc.called by network_api kwargs can contain fixed_ips to circumvent another db lookup """ - instance_id = kwargs.get('instance_id') + instance_id = kwargs.pop('instance_id') fixed_ips = kwargs.get('fixed_ips') or \ self.db.fixed_ip_get_all_by_instance(context, instance_id) LOG.debug(_("network deallocation for instance |%s|"), instance_id, -- cgit