Files
openstack-armada-app/openstack-helm/debian/deb_folder/patches/0026-Copy-host-UUID-into-Nova-s-config-dir.patch
Joao Fracarolli a47afb843b Provision host UUID to nova-compute
This change adds new overrides and an OSH patch to provision
nova-compute pods with their respective hosts' UUID. Before
this change, Nova was attributing a newly generated UUID for
each nova-compute pod, accordingly to the documentation [1].
To do this, we added a method in Nova's plugin that retrieves
all the hostnames and UUIDs and inject them via overrides
into Nova's Helm chart. The nova-compute-init script was
then modified to search the current host's UUID and save
it in the compute_id file in the state_path directory.

References:
[1] https://docs.openstack.org/nova/latest/admin/compute-node-identification.html

Test Plan:
 - PASS: build openstack-helm package
 - PASS: build python3-k8aspp-openstack package
 - PASS: generate application tarball
 - PASS: apply the application in a virtual deployment environment
 - PASS: check if the compute_id file is created with the correct UUID
 - PASS: check if the correct UUID is registered in the database
 - PASS: repeat the test in a lab with a couple of compute nodes
 - PASS: lock, reinstall and unlock one of the compute nodes and
   check if nova pods are running again, with the same UUID

Closes-Bug: 2117400

Change-Id: I4eb2e43b3465d1f92f9cc8ebf40018998fc054a8
Signed-off-by: Joao Fracarolli <joao.vicentinifracarolli@windriver.com>
2025-07-21 10:46:42 -03:00

69 lines
2.4 KiB
Diff

From e5561aef977b6d18ed06a773d04f0732efac590c Mon Sep 17 00:00:00 2001
From: Joao Fracarolli <joao.vicentinifracarolli@windriver.com>
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 <joao.vicentinifracarolli@windriver.com>
---
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