Skip to content

Commit 7c7a2a1

Browse files
SeanMooneystephenfin
authored andcommitted
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
1 parent 5cf06bf commit 7c7a2a1

File tree

6 files changed

+59
-21
lines changed

6 files changed

+59
-21
lines changed

doc/source/admin/availability-zones.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ placement aggregates that match the membership and UUID of nova host aggregates
6565
that you assign as availability zones. The same key in aggregate metadata used
6666
by the `AvailabilityZoneFilter` filter controls this function, and is enabled by
6767
setting :oslo.config:option:`scheduler.query_placement_for_availability_zone`
68-
to ``True``.
68+
to ``True``. As of 24.0.0 (Xena), this is the default.
6969

7070
.. code-block:: console
7171
@@ -102,11 +102,9 @@ to ``True``.
102102
103103
$ openstack --os-placement-api-version=1.2 resource provider aggregate set --aggregate 019e2189-31b3-49e1-aff2-b220ebd91c24 815a5634-86fb-4e1e-8824-8a631fee3e06
104104
105-
With the above configuration, the `AvailabilityZoneFilter` filter can be
106-
disabled in :oslo.config:option:`filter_scheduler.enabled_filters` while
107-
retaining proper behavior (and doing so with the higher performance of
108-
placement's implementation).
109-
105+
Without the above configuration, the `AvailabilityZoneFilter` filter must be
106+
enabled in :oslo.config:option:`filter_scheduler.enabled_filters` to retain
107+
proper behavior.
110108

111109
Implications for moving servers
112110
-------------------------------

doc/source/admin/configuration/schedulers.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Compute is configured with the following default scheduler options in the
1818
1919
[filter_scheduler]
2020
available_filters = nova.scheduler.filters.all_filters
21-
enabled_filters = AvailabilityZoneFilter, ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter
21+
enabled_filters = ComputeFilter, ComputeCapabilitiesFilter, ImagePropertiesFilter, ServerGroupAntiAffinityFilter, ServerGroupAffinityFilter
2222
2323
By default, the scheduler ``driver`` is configured as a filter scheduler, as
2424
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.
341341
AvailabilityZoneFilter
342342
----------------------
343343

344-
Filters hosts by availability zone. You must enable this filter for the
345-
scheduler to respect availability zones in requests.
344+
.. deprecated:: 24.0.0 (Xena)
345+
346+
The functionality of this filter has been replaced by
347+
:ref:`availability-zones-with-placement`.
348+
349+
Filters hosts by availability zone.
346350

347351
Refer to :doc:`/admin/availability-zones` for more information.
348352

nova/conf/scheduler.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,18 @@
150150
- ``[scheduler] placement_aggregate_required_for_tenants``
151151
"""),
152152
cfg.BoolOpt("query_placement_for_availability_zone",
153-
default=False,
153+
default=True,
154+
deprecated_for_removal=True,
155+
deprecated_since='24.0.0',
156+
deprecated_reason="""
157+
Since the introduction of placement pre-filters in 18.0.0 (Rocky), we have
158+
supported tracking Availability Zones either natively in placement or using the
159+
legacy ``AvailabilityZoneFilter`` scheduler filter. In 24.0.0 (Xena), the
160+
filter-based approach has been deprecated for removal in favor of the
161+
placement-based approach. As a result, this config option has also been
162+
deprecated and will be removed when the ``AvailabilityZoneFilter`` filter is
163+
removed.
164+
""",
154165
help="""
155166
Use placement to determine availability zones.
156167
@@ -164,8 +175,9 @@
164175
found, or that aggregate does not match one in placement, the result will
165176
be the same as not finding any suitable hosts.
166177
167-
Note that if you enable this flag, you can disable the (less efficient)
168-
AvailabilityZoneFilter in the scheduler.
178+
Note that if you disable this flag, you **must** enable the (less efficient)
179+
``AvailabilityZoneFilter`` in the scheduler in order to availability zones to
180+
work correctly.
169181
170182
Possible values:
171183
@@ -355,7 +367,6 @@
355367
# Tempest's scheduler_enabled_filters to keep the default values in
356368
# sync.
357369
default=[
358-
"AvailabilityZoneFilter",
359370
"ComputeFilter",
360371
"ComputeCapabilitiesFilter",
361372
"ImagePropertiesFilter",

nova/scheduler/filters/availability_zone_filter.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ class AvailabilityZoneFilter(filters.BaseHostFilter):
3737

3838
RUN_ON_REBUILD = False
3939

40+
def __init__(self):
41+
super().__init__()
42+
if CONF.scheduler.query_placement_for_availability_zone:
43+
LOG.warning(
44+
"The 'AvailabilityZoneFilter' is deprecated since the 24.0.0 "
45+
"(Xena) release. Since the 18.0.0 (Rocky) release, nova "
46+
"has supported mapping AZs to placement aggregates. "
47+
"The feature is enabled by the "
48+
"'query_placement_for_availability_zone' config option and "
49+
"is now enabled by default. As such, the "
50+
"'AvailabilityZoneFilter' is no longer required. Nova is "
51+
"currently configured to use both placement and the "
52+
"AvailabilityZoneFilter for AZ enforcement."
53+
)
54+
4055
def host_passes(self, host_state, spec_obj):
4156
availability_zone = spec_obj.availability_zone
4257

nova/tests/functional/test_aggregates.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,6 @@ def setUp(self):
444444
# Use custom weigher to make sure that we have a predictable
445445
# scheduling sort order.
446446
self.useFixture(nova_fixtures.HostNameWeigherFixture())
447-
448-
# NOTE(danms): Do this before calling setUp() so that
449-
# the scheduler service that is started sees the new value
450-
filters = CONF.filter_scheduler.enabled_filters
451-
filters.remove('AvailabilityZoneFilter')
452-
self.flags(enabled_filters=filters, group='filter_scheduler')
453-
454447
super(AvailabilityZoneFilterTest, self).setUp()
455448

456449
def test_filter_with_az(self):
@@ -729,7 +722,6 @@ def setUp(self):
729722
# NOTE(danms): Do this before calling setUp() so that
730723
# the scheduler service that is started sees the new value
731724
filters = CONF.filter_scheduler.enabled_filters
732-
filters.remove('AvailabilityZoneFilter')
733725

734726
# NOTE(shilpasd): To test `isolate_aggregates` request filter, removed
735727
# following filters which also filters hosts based on aggregate
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
deprecations:
3+
- |
4+
The ``AvailabilityZoneFilter`` scheduler filters is now deprecated
5+
for removal in a future release. The functionality of the
6+
``AvailabilityZoneFilter`` has been replaced by the
7+
``map_az_to_placement_aggregate`` pre-filter which was introduced in
8+
18.0.0 (Rocky). This pre-filter is now enabled by default and will be
9+
mandatory in a future release.
10+
upgrades:
11+
- |
12+
The ``AvailabilityZoneFilter`` has been removed from the default
13+
``[scheduler] enabled_filters`` list. The ``AvailabilityZoneFilter``
14+
is replaced by an optional placement pre-filter which is enabled by
15+
``[scheduler] query_placement_for_availability_zone``.
16+
The pre-filter is now enabled by default. If you choose to disable the
17+
AZ pre-filter, you will need to re-add ``AvailabilityZoneFilter`` to the
18+
``[scheduler] enabled_filters`` config value.

0 commit comments

Comments
 (0)