Deprecate filters that have been replaced by placement filters

This change deprecates the AZ filters which is no longer required.

This also enable the use of placement for AZ enforcement by default and
deprecates the config option for removal.

Change-Id: I92b0386432444fc8bdf852de4bdb6cebb370a8ca
This commit is contained in:
Sean Mooney 2020-08-10 23:45:11 +00:00 committed by Stephen Finucane
parent 5cf06bf33d
commit 7c7a2a142d
6 changed files with 59 additions and 21 deletions

View File

@ -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
-------------------------------

View File

@ -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.

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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.