Deprecate available filters in favor of enabled

Previously, Tempest's default for scheduler_available_filters was
'all'. This was different from Nova's default enabled_filters, which
does *not* include all possible filters available in Nova. Thus, in a
deployment where both options were kept at their default value,
Tempest's is_scheduler_filter_enabled() would return True for all
filters, even if those filters weren't enabled in Nova. In addition,
the 'available' wording could be made clearer. This patch deprecates
scheduler_available_filters, replacing it with
scheduler_enabled_filters. The latter has its default value set to
Nova's enabled_filters default.

Related-bug: 1628443
Change-Id: I5c87865dc650d383ee006d36b6d52cdd90577ab9
This commit is contained in:
Artom Lifshitz 2018-05-23 10:19:18 -04:00
parent da8aec9aed
commit 595ae16987
3 changed files with 39 additions and 17 deletions

View File

@ -0,0 +1,13 @@
---
deprecations:
- |
The ``scheduler_available_filters`` option is being deprecated in favor of
``scheduler_enabled_filters``. The new name is more indicative of what the
option means. ``scheduler_enabled_filters``'s default value is set to the
default value of Nova's ``enabled_filters``.
``scheduler_available_filters``'s default was `all`. There was confusion
around this value. Sometimes it was understood to mean the default Nova
filters are enabled, other times it was understood to mean all filters are
enabled. While `all` is still allowed for ``scheduler_enabled_filters`` for
backwards compatibility, it is strongly recommended to provide an explicit
list of filters that matches what's configured in nova.conf.

View File

@ -44,15 +44,14 @@ LOG = logging.getLogger(__name__)
def is_scheduler_filter_enabled(filter_name):
"""Check the list of enabled compute scheduler filters from config.
This function checks whether the given compute scheduler filter is
available and configured in the config file. If the
scheduler_available_filters option is set to 'all' (Default value. which
means default filters are configured in nova) in tempest.conf then, this
function returns True with assumption that requested filter 'filter_name'
is one of available filter in nova ("nova.scheduler.filters.all_filters").
This function checks whether the given compute scheduler filter is enabled
in the nova config file. If the scheduler_enabled_filters option is set to
'all' in tempest.conf then, this function returns True with assumption that
requested filter 'filter_name' is one of the enabled filters in nova
("nova.scheduler.filters.all_filters").
"""
filters = CONF.compute_feature_enabled.scheduler_available_filters
filters = CONF.compute_feature_enabled.scheduler_enabled_filters
if not filters:
return False
if 'all' in filters:

View File

@ -472,20 +472,30 @@ ComputeFeaturesGroup = [
cfg.BoolOpt('config_drive',
default=True,
help='Enable special configuration drive with metadata.'),
cfg.ListOpt('scheduler_available_filters',
default=['all'],
help="A list of enabled filters that nova will accept as hints"
" to the scheduler when creating a server. A special "
"entry 'all' indicates all filters that are included "
"with nova are enabled. Empty list indicates all filters "
"are disabled. The full list of available filters is in "
"nova.conf: filter_scheduler.enabled_filters. If the "
cfg.ListOpt('scheduler_enabled_filters',
default=["RetryFilter", "AvailabilityZoneFilter",
"ComputeFilter", "ComputeCapabilitiesFilter",
"ImagePropertiesFilter",
"ServerGroupAntiAffinityFilter",
"ServerGroupAffinityFilter"],
help="A list of enabled filters that Nova will accept as "
"hints to the scheduler when creating a server. If the "
"default value is overridden in nova.conf by the test "
"environment (which means that a different set of "
"filters is enabled than what is included in Nova by "
"default) then, this option must be configured to "
"default), then this option must be configured to "
"contain the same filters that Nova uses in the test "
"environment."),
"environment. A special entry 'all' indicates all "
"filters that are included with Nova are enabled. If "
"using 'all', be sure to enable all filters in "
"nova.conf, as tests can fail in unpredictable ways if "
"Nova's and Tempest's enabled filters don't match. "
"Empty list indicates all filters are disabled. The "
"full list of enabled filters is in nova.conf: "
"filter_scheduler.enabled_filters.",
deprecated_opts=[cfg.DeprecatedOpt(
'scheduler_available_filters',
group='compute-feature-enabled')]),
cfg.BoolOpt('swap_volume',
default=False,
help='Does the test environment support in-place swapping of '