From d7408278e371177dde49aa2e160cd79e5cef2993 Mon Sep 17 00:00:00 2001 From: Sylvain Bauza Date: Fri, 27 Feb 2015 17:09:54 +0100 Subject: [PATCH] Modify filters so they can look to HostState Now that HostState is updated with aggregates, we can change all the filters so they are looking at it instead of calling the AggregateList objects. That's the final patch of the series, hurrah. Implements: blueprint isolate-scheduler-db Change-Id: Id2e9533eaaedd237902e20b0279e58c6deb24681 --- .../scheduler/filters/aggregate_image_properties_isolation.py | 4 +--- nova/scheduler/filters/aggregate_instance_extra_specs.py | 4 +--- nova/scheduler/filters/aggregate_multitenancy_isolation.py | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/nova/scheduler/filters/aggregate_image_properties_isolation.py b/nova/scheduler/filters/aggregate_image_properties_isolation.py index 04e8f549b..36a35624f 100644 --- a/nova/scheduler/filters/aggregate_image_properties_isolation.py +++ b/nova/scheduler/filters/aggregate_image_properties_isolation.py @@ -48,9 +48,7 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter): spec = filter_properties.get('request_spec', {}) image_props = spec.get('image', {}).get('properties', {}) - context = filter_properties['context'] - metadata = utils.aggregate_metadata_get_by_host(context, - host_state.host) + metadata = utils.aggregate_metadata_get_by_host(host_state) for key, options in metadata.iteritems(): if (cfg_namespace and diff --git a/nova/scheduler/filters/aggregate_instance_extra_specs.py b/nova/scheduler/filters/aggregate_instance_extra_specs.py index f5043a2ce..bce8a8235 100644 --- a/nova/scheduler/filters/aggregate_instance_extra_specs.py +++ b/nova/scheduler/filters/aggregate_instance_extra_specs.py @@ -42,9 +42,7 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter): if 'extra_specs' not in instance_type: return True - context = filter_properties['context'] - metadata = utils.aggregate_metadata_get_by_host(context, - host_state.host) + metadata = utils.aggregate_metadata_get_by_host(host_state) for key, req in instance_type['extra_specs'].iteritems(): # Either not scope format, or aggregate_instance_extra_specs scope diff --git a/nova/scheduler/filters/aggregate_multitenancy_isolation.py b/nova/scheduler/filters/aggregate_multitenancy_isolation.py index a970ed66a..f2fae6e8c 100644 --- a/nova/scheduler/filters/aggregate_multitenancy_isolation.py +++ b/nova/scheduler/filters/aggregate_multitenancy_isolation.py @@ -40,9 +40,7 @@ class AggregateMultiTenancyIsolation(filters.BaseHostFilter): props = spec.get('instance_properties', {}) tenant_id = props.get('project_id') - context = filter_properties['context'] - metadata = utils.aggregate_metadata_get_by_host(context, - host_state.host, + metadata = utils.aggregate_metadata_get_by_host(host_state, key="filter_tenant_id") if metadata != {}: