New module "availability_zones" using context not follow habbit

Bug #1100598 reported by Tiantian Gao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Tiantian Gao

Bug Description

As in nova/availability_zones.py, the method def get_host_availability_zone() expect the first argument "context" is a module rather than a RequestContext object. The code is shown below.
For our preference, argument "context" is better to be a RequestContext object which contains the information of request user.

def get_host_availability_zone(context, host):
 metadata = db.aggregate_metadata_get_by_host(context.get_admin_context(), host, key='availability_zone')
 ....

This style may make coder confuse.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/19900

Changed in nova:
assignee: nobody → TianTian Gao (gtt116)
status: New → In Progress
Tiantian Gao (gtt116)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/19900
Committed: http://github.com/openstack/nova/commit/6d5e0fd2d488329f66f31a4d6a1153a4a64ed6aa
Submitter: Jenkins
Branch: master

commit 6d5e0fd2d488329f66f31a4d6a1153a4a64ed6aa
Author: gtt116 <gtt116@126.com>
Date: Thu Jan 17 07:36:43 2013 +0000

    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

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.