conf: Attempt to resolve TODOs in scheduler.py

There are five options marked with TODOs:

* periodic_task_interval - negative values are valid, making the TODO
  invalid
* host_subset_size - code was in-place to prevent negative values, so
  replace this code with a min parameter
* isolated_images - removing this option requires a little bit of
  thought and would likely require a blueprint. Retain this for now.
* max_instances_per_host, attestation_auth_timeout,
  soft_affinity_weight_multiplier,
  soft_anti_affinity_weight_multiplier - support funky value ranges
  which, semantically speaking, shouldn't be allowed.  Start logging
  any "invalid" values.

Change-Id: I8871b628f0ab892830ceeede68db16948cb293c8
This commit is contained in:
Stephen Finucane 2016-09-22 10:26:38 +01:00
parent 41ad9ea667
commit cf8b1e52c8
5 changed files with 30 additions and 5 deletions

View File

@ -99,7 +99,8 @@ be sure to test this with your selected scheduler.
Possible values:
* An integer, where the integer corresponds to periodic task interval in
seconds. A negative value disables periodic tasks.
seconds. 0 uses the default interval (60 seconds). A negative value disables
periodic tasks.
Related options:
@ -129,9 +130,9 @@ filter_scheduler_group = cfg.OptGroup(name="filter_scheduler",
title="Filter scheduler options")
filter_scheduler_opts = [
# TODO(sfinucan): Add 'min' paramter
cfg.IntOpt("host_subset_size",
default=1,
min=1,
deprecated_name="scheduler_host_subset_size",
deprecated_group="DEFAULT",
help="""

View File

@ -112,7 +112,7 @@ class FilterScheduler(driver.Scheduler):
LOG.debug("Weighed %(hosts)s", {'hosts': weighed_hosts})
host_subset_size = max(1, CONF.filter_scheduler.host_subset_size)
host_subset_size = CONF.filter_scheduler.host_subset_size
if host_subset_size < len(weighed_hosts):
weighed_hosts = weighed_hosts[0:host_subset_size]
chosen_host = random.choice(weighed_hosts)

View File

@ -53,6 +53,15 @@ class AggregateNumInstancesFilter(NumInstancesFilter):
def _get_max_instances_per_host(self, host_state, spec_obj):
max_instances_per_host = CONF.filter_scheduler.max_instances_per_host
# TODO(sfinucan): Remove this warning when the named config options
# gains a 'min' parameter.
if max_instances_per_host < 1:
LOG.warning(_LW('Future versions of nova will restrict the '
'"filter_scheduler.max_instances_per_host" config option to '
'values >=0. Update your configuration file to mitigate '
'future upgrade issues.'))
aggregate_vals = utils.aggregate_values_from_key(
host_state,
'max_instances_per_host')

View File

@ -154,6 +154,14 @@ class ComputeAttestationCache(object):
host = compute.hypervisor_hostname
self._init_cache_entry(host)
# TODO(sfinucan): Remove this warning when the named config options
# gains a 'min' parameter.
if CONF.trusted_computing.attestation_auth_timeout < 0:
LOG.warning(_LW('Future versions of nova will restrict the '
'"trusted_computing.attestation_auth_timeout" config option '
'to values >=0. Update your configuration file to mitigate '
'future upgrade issues.'))
def _cache_valid(self, host):
cachevalid = False
if host in self.compute_nodes:

View File

@ -63,7 +63,10 @@ class ServerGroupSoftAffinityWeigher(_SoftAffinityWeigherBase):
LOG.warning(_LW('For the soft_affinity_weight_multiplier only a '
'positive value is meaningful as a negative value '
'would mean that the affinity weigher would '
'prefer non-collocating placement.'))
'prefer non-collocating placement. Future '
'versions of nova will restrict the config '
'option to values >=0. Update your configuration '
'file to mitigate future upgrade issues.'))
self.warning_sent = True
return CONF.filter_scheduler.soft_affinity_weight_multiplier
@ -79,7 +82,11 @@ class ServerGroupSoftAntiAffinityWeigher(_SoftAffinityWeigherBase):
LOG.warning(_LW('For the soft_anti_affinity_weight_multiplier '
'only a positive value is meaningful as a '
'negative value would mean that the anti-affinity '
'weigher would prefer collocating placement.'))
'weigher would prefer collocating placement. '
'Future versions of nova will restrict the '
'config option to values >=0. Update your '
'configuration file to mitigate future upgrade '
'issues.'))
self.warning_sent = True
return CONF.filter_scheduler.soft_anti_affinity_weight_multiplier