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
This commit is contained in:
jichenjc 2014-03-02 09:15:59 +08:00
parent 4ed6043144
commit 60ad194656
7 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter):
spec = filter_properties.get('request_spec', {})
image_props = spec.get('image', {}).get('properties', {})
context = filter_properties['context'].elevated()
context = filter_properties['context']
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
for key, options in metadata.iteritems():

View File

@ -42,7 +42,7 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter):
if 'extra_specs' not in instance_type:
return True
context = filter_properties['context'].elevated()
context = filter_properties['context']
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
for key, req in instance_type['extra_specs'].iteritems():

View File

@ -39,7 +39,7 @@ class AggregateMultiTenancyIsolation(filters.BaseHostFilter):
props = spec.get('instance_properties', {})
tenant_id = props.get('project_id')
context = filter_properties['context'].elevated()
context = filter_properties['context']
metadata = db.aggregate_metadata_get_by_host(context, host_state.host,
key="filter_tenant_id")

View File

@ -39,7 +39,7 @@ class AvailabilityZoneFilter(filters.BaseHostFilter):
availability_zone = props.get('availability_zone')
if availability_zone:
context = filter_properties['context'].elevated()
context = filter_properties['context']
metadata = db.aggregate_metadata_get_by_host(
context, host_state.host, key='availability_zone')
if 'availability_zone' in metadata:

View File

@ -78,7 +78,7 @@ class AggregateCoreFilter(BaseCoreFilter):
"""
def _get_cpu_allocation_ratio(self, host_state, filter_properties):
context = filter_properties['context'].elevated()
context = filter_properties['context']
# TODO(uni): DB query in filter is a performance hit, especially for
# system with lots of hosts. Will need a general solution here to fix
# all filters with aggregate DB call things.

View File

@ -79,7 +79,7 @@ class AggregateRamFilter(BaseRamFilter):
"""
def _get_ram_allocation_ratio(self, host_state, filter_properties):
context = filter_properties['context'].elevated()
context = filter_properties['context']
# TODO(uni): DB query in filter is a performance hit, especially for
# system with lots of hosts. Will need a general solution here to fix
# all filters with aggregate DB call things.

View File

@ -51,7 +51,7 @@ class AggregateTypeAffinityFilter(filters.BaseHostFilter):
def host_passes(self, host_state, filter_properties):
instance_type = filter_properties.get('instance_type')
context = filter_properties['context'].elevated()
context = filter_properties['context']
metadata = db.aggregate_metadata_get_by_host(
context, host_state.host, key='instance_type')
return (len(metadata) == 0 or