← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1279216] [NEW] No longer any need to pass admin context to aggregate DB API methods

 

Public bug reported:

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

** Affects: nova
     Importance: Low
         Status: Triaged


** Tags: aggregates

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1279216

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

Status in OpenStack Compute (Nova):
  Triaged

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1279216/+subscriptions


Follow ups

References