No longer any need to pass admin context to aggregate DB API methods

Bug #1279216 reported by Mark McLoughlin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
jichenjc

Bug Description

Since https://review.openstack.org/67026 the aggregate DB APIs no longer require admin context

One implication of that is that methods like get_host_availability_zone() and get_availability_zones() no longer need to require an admin context and their callers, e.g.

    def _describe_availability_zones(self, context, **kwargs):
        ctxt = context.elevated()
        available_zones, not_available_zones = \
            availability_zones.get_availability_zones(ctxt)

no longer need to pass an elevated context

Also, in some of our scheduler filters, we do:

    def _get_cpu_allocation_ratio(self, host_state, filter_properties):
        context = filter_properties['context'].elevated()
        metadata = db.aggregate_metadata_get_by_host(
                     context, host_state.host, key='cpu_allocation_ratio')

and those too should no longer require an elevated context

Tags: aggregates
jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichencom (jichenjc)
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/79835

Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/79835
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=60ad1946567136445e83446d3774726f161c813e
Submitter: Jenkins
Branch: master

commit 60ad1946567136445e83446d3774726f161c813e
Author: jichenjc <email address hidden>
Date: Sun Mar 2 09:15:59 2014 +0800

    No longer any need to pass admin context to aggregate DB API methods

    No longer need to pass an elevated context because the check of
    admin has been removed in following patch:
    https://review.openstack.org/67026

    This patch removes the admin context elevated
    method in nova/scheduler sub-folder since it's not required any more.

    Change-Id: Ib768c97c9e84a9db44d866fa5fbfc4665ad7c73e
    Partial-Bug: #1279216

Revision history for this message
Tracy Jones (tjones-i) wrote :

Is there any additional work needed to close this bug?

Revision history for this message
jichenjc (jichenjc) wrote :

I think no because other to-do items related to policy might be put into bp ,thanks

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
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.