From bc1d19b680be111b290c94b3e08cd8558bfe94ae Mon Sep 17 00:00:00 2001 From: tpsilva Date: Fri, 4 Oct 2019 18:45:55 -0300 Subject: [PATCH] Add new config option to set host_subset_size A new config option called scheduler-host-subset-size was added to configure FilterScheduler's host_subset_size property, which size of the subset of best hosts selected by the scheduler. Change-Id: Ic61917732d50806f74be0b4e7c87a51d738afbe7 Closes-bug: #1846203 --- config.yaml | 14 ++++++++++++++ hooks/nova_cc_context.py | 2 ++ templates/ocata/nova.conf | 4 ++++ templates/pike/nova.conf | 4 ++++ templates/rocky/nova.conf | 4 ++++ 5 files changed, 28 insertions(+) diff --git a/config.yaml b/config.yaml index 3269430c..214d94cc 100644 --- a/config.yaml +++ b/config.yaml @@ -591,3 +591,17 @@ options: override YAML files in the service's policy.d directory. The resource file should be a ZIP file containing at least one yaml file with a .yaml or .yml extension. If False then remove the overrides. + scheduler-host-subset-size: + type: int + default: + description: | + The value to be configured for the host_subset_size property on + FilterScheduler. This property sets the size of the subset of best hosts + selected by the scheduler. + . + When a new instance is created, it will be scheduled on a host chosen + randomly from a subset of the best hosts with the size set by this + property. + . + Possible Values are positive integers. Any value less than 1 will be + treated as 1. diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index 08c5691a..0d066cbe 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -387,6 +387,8 @@ class NovaConfigContext(ch_context.WorkerConfigContext): ctxt['console_access_protocol'] = hookenv.config( 'console-access-protocol') ctxt['console_access_port'] = hookenv.config('console-access-port') + ctxt['scheduler_host_subset_size'] = hookenv.config( + 'scheduler-host-subset-size') return ctxt diff --git a/templates/ocata/nova.conf b/templates/ocata/nova.conf index d76d6c77..7811a806 100644 --- a/templates/ocata/nova.conf +++ b/templates/ocata/nova.conf @@ -193,6 +193,10 @@ enabled_filters = {{ scheduler_default_filters }},{{ additional_neutron_filters enabled_filters = {{ scheduler_default_filters }} {% endif %} +{%- if scheduler_host_subset_size %} +host_subset_size = {{ scheduler_host_subset_size }} +{%- endif %} + [api] auth_strategy=keystone {% if vendor_data or vendor_data_url -%} diff --git a/templates/pike/nova.conf b/templates/pike/nova.conf index e8e33288..84cfdde4 100644 --- a/templates/pike/nova.conf +++ b/templates/pike/nova.conf @@ -208,6 +208,10 @@ enabled_filters = {{ scheduler_default_filters }} # https://bugs.launchpad.net/charm-nova-cloud-controller/+bug/1818239 build_failure_weight_multiplier = 0.0 +{%- if scheduler_host_subset_size %} +host_subset_size = {{ scheduler_host_subset_size }} +{%- endif %} + [api] auth_strategy=keystone {% if vendor_data or vendor_data_url -%} diff --git a/templates/rocky/nova.conf b/templates/rocky/nova.conf index 986a6a34..ae95628a 100644 --- a/templates/rocky/nova.conf +++ b/templates/rocky/nova.conf @@ -214,6 +214,10 @@ enabled_filters = {{ scheduler_default_filters }} # https://bugs.launchpad.net/charm-nova-cloud-controller/+bug/1818239 build_failure_weight_multiplier = 0.0 +{%- if scheduler_host_subset_size %} +host_subset_size = {{ scheduler_host_subset_size }} +{%- endif %} + [api] auth_strategy=keystone {% if vendor_data or vendor_data_url -%}