summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorgtt116 <gtt116@126.com>2013-01-17 07:36:43 +0000
committergtt116 <gtt116@126.com>2013-01-22 02:15:36 +0000
commit6d5e0fd2d488329f66f31a4d6a1153a4a64ed6aa (patch)
tree8ee569bd2bf9f054a9e1b822cb06b2773b6b5e9f /nova/api
parenta4d608fa33b328d7ed77c7f9c40ffbb43c0ade6b (diff)
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
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/ec2utils.py3
1 files changed, 2 insertions, 1 deletions
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'