From e1ba842126cf9a073517dfcc3a974588e3dc2a83 Mon Sep 17 00:00:00 2001
From: Pierre Riteau <pierre@stackhpc.com>
Date: Tue, 7 Sep 2021 23:25:07 +0200
Subject: [PATCH] Allow to configure name of root disk image to provision

This may be used to deploy different images on different hosts.

Change-Id: I941cc28a914f3a56f50abdde70f13d6616ff52e7
Story: 2002098
Task: 41694
---
 ansible/group_vars/all/bifrost                 |  6 ++++++
 ansible/kolla-bifrost-hostvars.yml             |  1 +
 doc/source/configuration/reference/bifrost.rst | 18 +++++++++++++++++-
 etc/kayobe/bifrost.yml                         |  6 ++++++
 ...deploy-image-filename-716c12e71c769a27.yaml |  6 ++++++
 5 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/bifrost-deploy-image-filename-716c12e71c769a27.yaml

diff --git a/ansible/group_vars/all/bifrost b/ansible/group_vars/all/bifrost
index ee9bef43..1b9f5f24 100644
--- a/ansible/group_vars/all/bifrost
+++ b/ansible/group_vars/all/bifrost
@@ -54,6 +54,12 @@ kolla_bifrost_dib_env_vars: "{{ kolla_bifrost_dib_env_vars_default | combine(kol
 # List of DIB packages to install.
 kolla_bifrost_dib_packages: []
 
+###############################################################################
+# Disk image deployment configuration.
+
+# Name of disk image file to deploy. Default is "deployment_image.qcow2".
+kolla_bifrost_deploy_image_filename: "deployment_image.qcow2"
+
 ###############################################################################
 # Ironic configuration.
 
diff --git a/ansible/kolla-bifrost-hostvars.yml b/ansible/kolla-bifrost-hostvars.yml
index 55e01d2b..0de2d801 100644
--- a/ansible/kolla-bifrost-hostvars.yml
+++ b/ansible/kolla-bifrost-hostvars.yml
@@ -14,6 +14,7 @@
     ansible_host: "{{ hostvars[seed_host].ansible_host | default(seed_host) }}"
     bifrost_hostvars:
       addressing_mode: static
+      deploy_image_filename: "{{ kolla_bifrost_deploy_image_filename }}"
       ipv4_interface_mac: "{% raw %}{{ extra.pxe_interface_mac | default }}{% endraw %}"
       ipv4_address: "{{ admin_oc_net_name | net_ip }}"
       ipv4_subnet_mask: "{{ admin_oc_net_name | net_cidr | ipaddr('netmask') }}"
diff --git a/doc/source/configuration/reference/bifrost.rst b/doc/source/configuration/reference/bifrost.rst
index 21307eac..15d718ba 100644
--- a/doc/source/configuration/reference/bifrost.rst
+++ b/doc/source/configuration/reference/bifrost.rst
@@ -179,6 +179,22 @@ Rather than needing to write a custom DIB element, we can use the
    kolla_bifrost_dib_packages:
      - "biosdevname"
 
+Disk image deployment configuration
+===================================
+
+The name of the root disk image to deploy can be configured via the
+``kolla_bifrost_deploy_image_filename`` option, which defaults to
+``deployment_image.qcow2``. It can be defined globally in
+``${KAYOBE_CONFIG_PATH}/bifrost.yml``, or defined per-group or per-host in the
+Kayobe inventory. This can be used to provision different images across the
+overcloud.
+
+.. note::
+
+   Support for building multiple disk images is not yet available. Images can
+   be manually renamed before changing the Kayobe configuration to build a
+   different image.
+
 Ironic configuration
 ====================
 
@@ -283,7 +299,7 @@ Inventory configuration
    This feature is currently not well tested. It is advisable to use
    autodiscovery of overcloud servers instead.
 
-The following options are used to configure a static inventory of servers for
+The following option is used to configure a static inventory of servers for
 Bifrost.
 
 ``kolla_bifrost_servers``
diff --git a/etc/kayobe/bifrost.yml b/etc/kayobe/bifrost.yml
index 34f84ef3..85d018d3 100644
--- a/etc/kayobe/bifrost.yml
+++ b/etc/kayobe/bifrost.yml
@@ -53,6 +53,12 @@
 # List of DIB packages to install. Default is to install no extra packages.
 #kolla_bifrost_dib_packages:
 
+###############################################################################
+# Disk image deployment configuration.
+
+# Name of disk image file to deploy. Default is "deployment_image.qcow2".
+#kolla_bifrost_deploy_image_filename:
+
 ###############################################################################
 # Ironic configuration.
 
diff --git a/releasenotes/notes/bifrost-deploy-image-filename-716c12e71c769a27.yaml b/releasenotes/notes/bifrost-deploy-image-filename-716c12e71c769a27.yaml
new file mode 100644
index 00000000..813826ca
--- /dev/null
+++ b/releasenotes/notes/bifrost-deploy-image-filename-716c12e71c769a27.yaml
@@ -0,0 +1,6 @@
+---
+features:
+  - |
+    Adds a new ``kolla_bifrost_deploy_image_filename`` variable used to define
+    the name of the root disk image to provision. This may be used to deploy
+    different images on different hosts.
-- 
GitLab