Add scheduler-max-attempts flag
Using affinity/anti-affinity policies sometimes we get into a race condition on the resources that are available on the hypervisors. This flag allows to increase the number of retries and hence hosts to schedule on and therefore allowing the successful scheduling of instances. This option was taken from the following URL, while future work with placement is done to help with scheduling with affinity https://docs.openstack.org/nova/latest/admin/troubleshooting/affinity-policy-violated.html Signed-off-by: Arif Ali <arif.ali@canonical.com> Change-Id: I353dbaa38eb0526014888ede27702b428eb66afd
This commit is contained in:
parent
690d1d190c
commit
cdaa255120
11
config.yaml
11
config.yaml
@ -617,6 +617,17 @@ options:
|
|||||||
.
|
.
|
||||||
Possible Values are positive integers. Any value less than 1 will be
|
Possible Values are positive integers. Any value less than 1 will be
|
||||||
treated as 1.
|
treated as 1.
|
||||||
|
scheduler-max-attempts:
|
||||||
|
type: int
|
||||||
|
default:
|
||||||
|
description: |
|
||||||
|
The value to be configured for max_attempts property under scheduler.
|
||||||
|
.
|
||||||
|
This is useful for rescheduling instances to hosts when affinity policies
|
||||||
|
are in place as described in the following URL
|
||||||
|
https://docs.openstack.org/nova/latest/admin/troubleshooting/affinity-policy-violated.html
|
||||||
|
.
|
||||||
|
The default 3
|
||||||
spice-agent-enabled: # LP: #1856602
|
spice-agent-enabled: # LP: #1856602
|
||||||
type: boolean
|
type: boolean
|
||||||
default: True # OpenStack's default value.
|
default: True # OpenStack's default value.
|
||||||
|
@ -440,6 +440,8 @@ class NovaConfigContext(ch_context.WorkerConfigContext):
|
|||||||
ctxt['console_access_port'] = hookenv.config('console-access-port')
|
ctxt['console_access_port'] = hookenv.config('console-access-port')
|
||||||
ctxt['scheduler_host_subset_size'] = hookenv.config(
|
ctxt['scheduler_host_subset_size'] = hookenv.config(
|
||||||
'scheduler-host-subset-size')
|
'scheduler-host-subset-size')
|
||||||
|
ctxt['scheduler_max_attempts'] = hookenv.config(
|
||||||
|
'scheduler-max-attempts')
|
||||||
ctxt['unique_server_names'] = hookenv.config('unique-server-names')
|
ctxt['unique_server_names'] = hookenv.config('unique-server-names')
|
||||||
ctxt['skip_hosts_with_build_failures'] = hookenv.config(
|
ctxt['skip_hosts_with_build_failures'] = hookenv.config(
|
||||||
'skip-hosts-with-build-failures')
|
'skip-hosts-with-build-failures')
|
||||||
|
@ -205,6 +205,10 @@ enabled_filters = {{ scheduler_default_filters }}
|
|||||||
host_subset_size = {{ scheduler_host_subset_size }}
|
host_subset_size = {{ scheduler_host_subset_size }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if scheduler_max_attempts %}
|
||||||
|
max_attempts = {{ scheduler_max_attempts }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
[api]
|
[api]
|
||||||
auth_strategy=keystone
|
auth_strategy=keystone
|
||||||
{% if vendor_data or vendor_data_url -%}
|
{% if vendor_data or vendor_data_url -%}
|
||||||
|
@ -219,6 +219,10 @@ build_failure_weight_multiplier = 0.0
|
|||||||
host_subset_size = {{ scheduler_host_subset_size }}
|
host_subset_size = {{ scheduler_host_subset_size }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if scheduler_max_attempts %}
|
||||||
|
max_attempts = {{ scheduler_max_attempts }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
[api]
|
[api]
|
||||||
auth_strategy=keystone
|
auth_strategy=keystone
|
||||||
{% if vendor_data or vendor_data_url -%}
|
{% if vendor_data or vendor_data_url -%}
|
||||||
|
@ -221,6 +221,10 @@ build_failure_weight_multiplier = 0.0
|
|||||||
host_subset_size = {{ scheduler_host_subset_size }}
|
host_subset_size = {{ scheduler_host_subset_size }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if scheduler_max_attempts %}
|
||||||
|
max_attempts = {{ scheduler_max_attempts }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
[api]
|
[api]
|
||||||
auth_strategy=keystone
|
auth_strategy=keystone
|
||||||
{% if vendor_data or vendor_data_url -%}
|
{% if vendor_data or vendor_data_url -%}
|
||||||
|
@ -235,6 +235,10 @@ build_failure_weight_multiplier = 0.0
|
|||||||
host_subset_size = {{ scheduler_host_subset_size }}
|
host_subset_size = {{ scheduler_host_subset_size }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if scheduler_max_attempts %}
|
||||||
|
max_attempts = {{ scheduler_max_attempts }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
[api]
|
[api]
|
||||||
auth_strategy=keystone
|
auth_strategy=keystone
|
||||||
{% if vendor_data or vendor_data_url -%}
|
{% if vendor_data or vendor_data_url -%}
|
||||||
|
@ -341,10 +341,13 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
mock_config_ip.side_effect = self.test_config.get
|
mock_config_ip.side_effect = self.test_config.get
|
||||||
mock_unit_get.return_value = '127.0.0.1'
|
mock_unit_get.return_value = '127.0.0.1'
|
||||||
self.test_config.set('scheduler-default-filters', 'TestFilter')
|
self.test_config.set('scheduler-default-filters', 'TestFilter')
|
||||||
|
self.test_config.set('scheduler-max-attempts', 10)
|
||||||
self.test_config.set('unique-server-names', 'project')
|
self.test_config.set('unique-server-names', 'project')
|
||||||
ctxt = context.NovaConfigContext()()
|
ctxt = context.NovaConfigContext()()
|
||||||
self.assertEqual(ctxt['scheduler_default_filters'],
|
self.assertEqual(ctxt['scheduler_default_filters'],
|
||||||
self.config('scheduler-default-filters'))
|
self.config('scheduler-default-filters'))
|
||||||
|
self.assertEqual(ctxt['scheduler_max_attempts'],
|
||||||
|
self.config('scheduler-max-attempts'))
|
||||||
self.assertEqual(ctxt['cpu_allocation_ratio'],
|
self.assertEqual(ctxt['cpu_allocation_ratio'],
|
||||||
self.config('cpu-allocation-ratio'))
|
self.config('cpu-allocation-ratio'))
|
||||||
self.assertEqual(ctxt['ram_allocation_ratio'],
|
self.assertEqual(ctxt['ram_allocation_ratio'],
|
||||||
|
Loading…
Reference in New Issue
Block a user