From 6d5e0fd2d488329f66f31a4d6a1153a4a64ed6aa Mon Sep 17 00:00:00 2001 From: gtt116 Date: Thu, 17 Jan 2013 07:36:43 +0000 Subject: Fix incorrect use of context object As in nova/availability_zones.py, the method get_host_availability_zone() expects "context" as a module rather than a RequestContext object. But for our preference, the argument "context" is better to be a RequestContext object. So fix this by passing an context object into the method. * Fix the usage of argument "context" * Add unittest for the module "availability_zones" Fix bug lp:#1100598 Change-Id: I5886ba26131261d97be65f18e9492c40401c5a7f --- nova/api/ec2/ec2utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py index 1ce880de4..bc47b3e0d 100644 --- a/nova/api/ec2/ec2utils.py +++ b/nova/api/ec2/ec2utils.py @@ -117,7 +117,8 @@ def get_ip_info_for_instance(context, instance): def get_availability_zone_by_host(services, host): if len(services) > 0: - return availability_zones.get_host_availability_zone(context, host) + return availability_zones.get_host_availability_zone( + context.get_admin_context(), host) return 'unknown zone' -- cgit