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:
parent
4ed6043144
commit
60ad194656
@ -49,7 +49,7 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter):
|
|||||||
|
|
||||||
spec = filter_properties.get('request_spec', {})
|
spec = filter_properties.get('request_spec', {})
|
||||||
image_props = spec.get('image', {}).get('properties', {})
|
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)
|
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
|
||||||
|
|
||||||
for key, options in metadata.iteritems():
|
for key, options in metadata.iteritems():
|
||||||
|
@ -42,7 +42,7 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter):
|
|||||||
if 'extra_specs' not in instance_type:
|
if 'extra_specs' not in instance_type:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
context = filter_properties['context'].elevated()
|
context = filter_properties['context']
|
||||||
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
|
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
|
||||||
|
|
||||||
for key, req in instance_type['extra_specs'].iteritems():
|
for key, req in instance_type['extra_specs'].iteritems():
|
||||||
|
@ -39,7 +39,7 @@ class AggregateMultiTenancyIsolation(filters.BaseHostFilter):
|
|||||||
props = spec.get('instance_properties', {})
|
props = spec.get('instance_properties', {})
|
||||||
tenant_id = props.get('project_id')
|
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,
|
metadata = db.aggregate_metadata_get_by_host(context, host_state.host,
|
||||||
key="filter_tenant_id")
|
key="filter_tenant_id")
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class AvailabilityZoneFilter(filters.BaseHostFilter):
|
|||||||
availability_zone = props.get('availability_zone')
|
availability_zone = props.get('availability_zone')
|
||||||
|
|
||||||
if availability_zone:
|
if availability_zone:
|
||||||
context = filter_properties['context'].elevated()
|
context = filter_properties['context']
|
||||||
metadata = db.aggregate_metadata_get_by_host(
|
metadata = db.aggregate_metadata_get_by_host(
|
||||||
context, host_state.host, key='availability_zone')
|
context, host_state.host, key='availability_zone')
|
||||||
if 'availability_zone' in metadata:
|
if 'availability_zone' in metadata:
|
||||||
|
@ -78,7 +78,7 @@ class AggregateCoreFilter(BaseCoreFilter):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _get_cpu_allocation_ratio(self, host_state, filter_properties):
|
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
|
# 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
|
# system with lots of hosts. Will need a general solution here to fix
|
||||||
# all filters with aggregate DB call things.
|
# all filters with aggregate DB call things.
|
||||||
|
@ -79,7 +79,7 @@ class AggregateRamFilter(BaseRamFilter):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def _get_ram_allocation_ratio(self, host_state, filter_properties):
|
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
|
# 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
|
# system with lots of hosts. Will need a general solution here to fix
|
||||||
# all filters with aggregate DB call things.
|
# all filters with aggregate DB call things.
|
||||||
|
@ -51,7 +51,7 @@ class AggregateTypeAffinityFilter(filters.BaseHostFilter):
|
|||||||
|
|
||||||
def host_passes(self, host_state, filter_properties):
|
def host_passes(self, host_state, filter_properties):
|
||||||
instance_type = filter_properties.get('instance_type')
|
instance_type = filter_properties.get('instance_type')
|
||||||
context = filter_properties['context'].elevated()
|
context = filter_properties['context']
|
||||||
metadata = db.aggregate_metadata_get_by_host(
|
metadata = db.aggregate_metadata_get_by_host(
|
||||||
context, host_state.host, key='instance_type')
|
context, host_state.host, key='instance_type')
|
||||||
return (len(metadata) == 0 or
|
return (len(metadata) == 0 or
|
||||||
|
Loading…
Reference in New Issue
Block a user