diff --git a/doc/source/admin/availability-zones.rst b/doc/source/admin/availability-zones.rst index 95cc44e10cf3..678aff2c5a5f 100644 --- a/doc/source/admin/availability-zones.rst +++ b/doc/source/admin/availability-zones.rst @@ -65,7 +65,7 @@ placement aggregates that match the membership and UUID of nova host aggregates that you assign as availability zones. The same key in aggregate metadata used by the `AvailabilityZoneFilter` filter controls this function, and is enabled by setting :oslo.config:option:`scheduler.query_placement_for_availability_zone` -to ``True``. +to ``True``. As of 24.0.0 (Xena), this is the default. .. code-block:: console @@ -102,11 +102,9 @@ to ``True``. $ openstack --os-placement-api-version=1.2 resource provider aggregate set --aggregate 019e2189-31b3-49e1-aff2-b220ebd91c24 815a5634-86fb-4e1e-8824-8a631fee3e06 -With the above configuration, the `AvailabilityZoneFilter` filter can be -disabled in :oslo.config:option:`filter_scheduler.enabled_filters` while -retaining proper behavior (and doing so with the higher performance of -placement's implementation). - +Without the above configuration, the `AvailabilityZoneFilter` filter must be +enabled in :oslo.config:option:`filter_scheduler.enabled_filters` to retain +proper behavior. Implications for moving servers ------------------------------- diff --git a/doc/source/admin/configuration/schedulers.rst b/doc/source/admin/configuration/schedulers.rst index 78539c0be6e2..f99223070327 100644 --- a/doc/source/admin/configuration/schedulers.rst +++ b/doc/source/admin/configuration/schedulers.rst @@ -18,7 +18,7 @@ Compute is configured with the following default scheduler options in the [filter_scheduler] available_filters = nova.scheduler.filters.all_filters - enabled_filters = AvailabilityZoneFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter + enabled_filters = ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter By default, the scheduler ``driver`` is configured as a filter scheduler, as described in the next section. In the default configuration, this scheduler @@ -341,8 +341,12 @@ This is a no-op filter. It does not eliminate any of the available hosts. AvailabilityZoneFilter ---------------------- -Filters hosts by availability zone. You must enable this filter for the -scheduler to respect availability zones in requests. +.. deprecated:: 24.0.0 (Xena) + + The functionality of this filter has been replaced by + :ref:`availability-zones-with-placement`. + +Filters hosts by availability zone. Refer to :doc:`/admin/availability-zones` for more information. diff --git a/nova/conf/scheduler.py b/nova/conf/scheduler.py index eb927b262e96..3b7e518eb535 100644 --- a/nova/conf/scheduler.py +++ b/nova/conf/scheduler.py @@ -150,7 +150,18 @@ Related options: - ``[scheduler] placement_aggregate_required_for_tenants`` """), cfg.BoolOpt("query_placement_for_availability_zone", - default=False, + default=True, + deprecated_for_removal=True, + deprecated_since='24.0.0', + deprecated_reason=""" +Since the introduction of placement pre-filters in 18.0.0 (Rocky), we have +supported tracking Availability Zones either natively in placement or using the +legacy ``AvailabilityZoneFilter`` scheduler filter. In 24.0.0 (Xena), the +filter-based approach has been deprecated for removal in favor of the +placement-based approach. As a result, this config option has also been +deprecated and will be removed when the ``AvailabilityZoneFilter`` filter is +removed. +""", help=""" Use placement to determine availability zones. @@ -164,8 +175,9 @@ operation. If no host aggregate with the `availability_zone` key is found, or that aggregate does not match one in placement, the result will be the same as not finding any suitable hosts. -Note that if you enable this flag, you can disable the (less efficient) -AvailabilityZoneFilter in the scheduler. +Note that if you disable this flag, you **must** enable the (less efficient) +``AvailabilityZoneFilter`` in the scheduler in order to availability zones to +work correctly. Possible values: @@ -355,7 +367,6 @@ Related options: # Tempest's scheduler_enabled_filters to keep the default values in # sync. default=[ - "AvailabilityZoneFilter", "ComputeFilter", "ComputeCapabilitiesFilter", "ImagePropertiesFilter", diff --git a/nova/scheduler/filters/availability_zone_filter.py b/nova/scheduler/filters/availability_zone_filter.py index f48a9f357106..a0f4a669b00c 100644 --- a/nova/scheduler/filters/availability_zone_filter.py +++ b/nova/scheduler/filters/availability_zone_filter.py @@ -37,6 +37,21 @@ class AvailabilityZoneFilter(filters.BaseHostFilter): RUN_ON_REBUILD = False + def __init__(self): + super().__init__() + if CONF.scheduler.query_placement_for_availability_zone: + LOG.warning( + "The 'AvailabilityZoneFilter' is deprecated since the 24.0.0 " + "(Xena) release. Since the 18.0.0 (Rocky) release, nova " + "has supported mapping AZs to placement aggregates. " + "The feature is enabled by the " + "'query_placement_for_availability_zone' config option and " + "is now enabled by default. As such, the " + "'AvailabilityZoneFilter' is no longer required. Nova is " + "currently configured to use both placement and the " + "AvailabilityZoneFilter for AZ enforcement." + ) + def host_passes(self, host_state, spec_obj): availability_zone = spec_obj.availability_zone diff --git a/nova/tests/functional/test_aggregates.py b/nova/tests/functional/test_aggregates.py index 60c2d20a14b2..508c435f547d 100644 --- a/nova/tests/functional/test_aggregates.py +++ b/nova/tests/functional/test_aggregates.py @@ -444,13 +444,6 @@ class AvailabilityZoneFilterTest(AggregateRequestFiltersTest): # Use custom weigher to make sure that we have a predictable # scheduling sort order. self.useFixture(nova_fixtures.HostNameWeigherFixture()) - - # NOTE(danms): Do this before calling setUp() so that - # the scheduler service that is started sees the new value - filters = CONF.filter_scheduler.enabled_filters - filters.remove('AvailabilityZoneFilter') - self.flags(enabled_filters=filters, group='filter_scheduler') - super(AvailabilityZoneFilterTest, self).setUp() def test_filter_with_az(self): @@ -729,7 +722,6 @@ class TestAggregateFiltersTogether(AggregateRequestFiltersTest): # NOTE(danms): Do this before calling setUp() so that # the scheduler service that is started sees the new value filters = CONF.filter_scheduler.enabled_filters - filters.remove('AvailabilityZoneFilter') # NOTE(shilpasd): To test `isolate_aggregates` request filter, removed # following filters which also filters hosts based on aggregate diff --git a/releasenotes/notes/deprecate-AZ-filter-28406abc0135c1c3.yaml b/releasenotes/notes/deprecate-AZ-filter-28406abc0135c1c3.yaml new file mode 100644 index 000000000000..2e258ad38c17 --- /dev/null +++ b/releasenotes/notes/deprecate-AZ-filter-28406abc0135c1c3.yaml @@ -0,0 +1,18 @@ +--- +deprecations: + - | + The ``AvailabilityZoneFilter`` scheduler filters is now deprecated + for removal in a future release. The functionality of the + ``AvailabilityZoneFilter`` has been replaced by the + ``map_az_to_placement_aggregate`` pre-filter which was introduced in + 18.0.0 (Rocky). This pre-filter is now enabled by default and will be + mandatory in a future release. +upgrades: + - | + The ``AvailabilityZoneFilter`` has been removed from the default + ``[scheduler] enabled_filters`` list. The ``AvailabilityZoneFilter`` + is replaced by an optional placement pre-filter which is enabled by + ``[scheduler] query_placement_for_availability_zone``. + The pre-filter is now enabled by default. If you choose to disable the + AZ pre-filter, you will need to re-add ``AvailabilityZoneFilter`` to the + ``[scheduler] enabled_filters`` config value.