Support custom Nova Compute Ironic host names

This fixes an issue where it is not possible to customise the `host`
config option in the Nova Compute Ironic config file without breaking
detection of the service.

This is a backwards compatible fix, which allows a user to set the
`host` config option using Ansible host or group vars.

Other reasons for not using the default host setting of
`{{ ansible_hostname }}-ironic` are covered in [1].

[1] https://specs.openstack.org/openstack/nova-specs/specs/2024.1/approved/ironic-shards.html#migrate-from-peer-list-to-shard-key.

Closes-Bug: #2056571
Change-Id: I9b562f6a5722f21b7dbec2a4d53a46a57c829155
This commit is contained in:
Doug Szumski 2024-03-11 16:48:48 +00:00
parent fc44651d62
commit ac7c1e96e3
4 changed files with 51 additions and 2 deletions

View File

@ -79,7 +79,7 @@
# configure for [DEFAULT] host in nova.conf.
ironic_compute_service_hosts: >-
{{ ironic_computes_in_batch |
map('extract', hostvars, ['ansible_facts', 'hostname']) |
map('extract', hostvars) | json_query('[].nova_compute_ironic_custom_host || [].ansible_facts.hostname') |
map('regex_replace', '^(.*)$', '\1-ironic') |
list }}
expected_compute_service_hosts: "{{ virt_compute_service_hosts + ironic_compute_service_hosts }}"

View File

@ -9,7 +9,7 @@ state_path = /var/lib/nova
allow_resize_to_same_host = true
{% if service_name == "nova-compute-ironic" %}
host={{ ansible_facts.hostname }}-ironic
host={{ nova_compute_ironic_custom_host | default(ansible_facts.hostname) }}-ironic
log_file = /var/log/kolla/nova/nova-compute-ironic.log
compute_driver = ironic.IronicDriver
ram_allocation_ratio = 1.0

View File

@ -148,6 +148,49 @@ variable ``ironic_enable_keystone_integration`` to ``"yes"``
ironic_enable_keystone_integration: "yes"
Avoiding problems with high availability
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
This section assumes that you have not yet deployed the Nova Compute
Ironic service. If you have already deployed multiple instances of the
service and have one or more baremetal nodes registered, the following
operations are non-trivial. You will likely have to use the `nova-manage`
command (or pre-Caracal edit the DB) to ensure that all Ironic nodes
are registered with a single Nova Compute Ironic instance. This is
an advanced subject and is not covered here. Stop now if you don't
know what you are doing.
Nova Compute Ironic HA is known to be unstable. Pending a better solution,
a workaround is to avoid the feature by running a single Nova Compute Ironic
instance. For example:
.. code-block:: diff
- [nova-compute-ironic:children]
- nova
+ [nova-compute-ironic]
+ controller1
If you choose to do this, it is helpful to pin the service host name
to a 'synthetic' constant. This means that if you need to re-deploy the
service to another host, the Ironic nodes will automatically use the new
service instance. Otherwise you will need to manually move active Ironic nodes
to the new service, with either the `nova-manage` CLI, or pre-Caracal, by
editing the Nova database.
The config option to pin the host name is `nova_compute_ironic_custom_host`
and must be set as a group or host var. Note that, unless you know what you
are doing, you must not change or set this option if you have already deployed
Ironic nodes.
This config option is also useful for Ironic Shards. Whilst these are not
explicitly supported by Kolla Ansible, some further information can be found
`here <https://specs.openstack.org/openstack/nova-specs/specs/2024.1/approved/ironic-shards.html>`__.
Note that Ironic HA is not affected, and continues to work as normal.
Deployment
~~~~~~~~~~
Run the deploy as usual:

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes the detection of the Nova Compute Ironic service when a custom `host`
option is set in the service config file.
See `LP#2056571 <https://launchpad.net/bugs/2056571>`__