From e5561aef977b6d18ed06a773d04f0732efac590c Mon Sep 17 00:00:00 2001 From: Joao Fracarolli Date: Fri, 11 Jul 2025 14:45:55 -0300 Subject: [PATCH] Copy host UUID into Nova's config dir This patch adds some new fields in Nova's chart. The first one, 'hosts_uuids', contains a list of hosts and its respectives UUIDs. By default, this list is empty and is populated through system overrides. The second one is 'manifests.compute_uuid_self_provisioning',which is used to set self provisioning on or off. The default is 'true'. It also adds a code in nova-compute-init.sh script to copy the current host's UUID obtained via helm chart into the Nova's state_path directory, in order to ensure that Nova will always use the same UUID of the node it's running in. By doing this, we are provisioning the UUID, accordingly to [1]. [1] https://docs.openstack.org/nova/latest/admin/compute-node-identification.html Signed-off-by: Joao Fracarolli --- nova/templates/bin/_nova-compute-init.sh.tpl | 10 ++++++++++ nova/values.yaml | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/nova/templates/bin/_nova-compute-init.sh.tpl b/nova/templates/bin/_nova-compute-init.sh.tpl index 4bc71a393..5218d3707 100644 --- a/nova/templates/bin/_nova-compute-init.sh.tpl +++ b/nova/templates/bin/_nova-compute-init.sh.tpl @@ -16,6 +16,16 @@ limitations under the License. set -ex +{{- if and .Values.hosts_uuids (not .Values.manifests.compute_uuid_self_provisioning) }} +# Extract Host's uuid from helm chart and save it to the compute_id file + {{- range $host := .Values.hosts_uuids }} +hostname="{{- $host.name}}" +if [ "$hostname" == $HOSTNAME ]; then + echo "{{ $host.uuid }}" > {{ $.Values.conf.nova.DEFAULT.state_path }}/compute_id +fi + {{- end }} +{{- end }} + # Make the Nova Instances Dir as this is not autocreated. mkdir -p /var/lib/nova/instances diff --git a/nova/values.yaml b/nova/values.yaml index 621d52b95..08288dfc5 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -2554,6 +2554,7 @@ tls: manifests: certificates: false + compute_uuid_self_provisioning: true configmap_bin: true configmap_etc: true cron_job_cell_setup: true @@ -2602,4 +2603,7 @@ manifests: service_spiceproxy: true service_osapi: true statefulset_compute_ironic: false + +# List of hosts and uuids +hosts_uuids: [] ... -- 2.34.1