From 5b44571248b6251942928538da5689ecf7b81abe Mon Sep 17 00:00:00 2001
From: Pierre Riteau <pierre@stackhpc.com>
Date: Fri, 19 Jun 2020 12:19:16 +0200
Subject: [PATCH] Support configuration of Bifrost's Ironic extra kernel
 parameters

Change-Id: I3f96c877b24d4a400578dc618a6dc488c0fdeeef
Story: 2001987
Task: 19607
---
 ansible/group_vars/all/bifrost                             | 4 ++++
 ansible/roles/kolla-bifrost/defaults/main.yml              | 4 ++++
 ansible/roles/kolla-bifrost/templates/bifrost.yml.j2       | 6 ++++++
 doc/source/configuration/bifrost.rst                       | 4 ++++
 etc/kayobe/bifrost.yml                                     | 4 ++++
 ...ifrost-ironic-extra-kernel-params-e3e56a9dcdf24bb6.yaml | 7 +++++++
 6 files changed, 29 insertions(+)
 create mode 100644 releasenotes/notes/bifrost-ironic-extra-kernel-params-e3e56a9dcdf24bb6.yaml

diff --git a/ansible/group_vars/all/bifrost b/ansible/group_vars/all/bifrost
index 56f89e3b9..c73e4957f 100644
--- a/ansible/group_vars/all/bifrost
+++ b/ansible/group_vars/all/bifrost
@@ -55,6 +55,10 @@ kolla_bifrost_dib_packages: []
 kolla_bifrost_enabled_hardware_types:
   - ipmi
 
+# List of extra kernel parameters for Bifrost's Ironic PXE configuration.
+# Default is empty.
+kolla_bifrost_extra_kernel_options: []
+
 ###############################################################################
 # Ironic Inspector configuration.
 
diff --git a/ansible/roles/kolla-bifrost/defaults/main.yml b/ansible/roles/kolla-bifrost/defaults/main.yml
index de705acd0..2d4ddb187 100644
--- a/ansible/roles/kolla-bifrost/defaults/main.yml
+++ b/ansible/roles/kolla-bifrost/defaults/main.yml
@@ -23,6 +23,10 @@ kolla_bifrost_dib_packages: []
 # List of hardware types to enable for Bifrost's Ironic.
 kolla_bifrost_enabled_hardware_types: []
 
+# List of extra kernel parameters for Bifrost's Ironic PXE configuration.
+# Default is empty.
+kolla_bifrost_extra_kernel_options: []
+
 # IP address range for DHCP.
 kolla_bifrost_dhcp_pool_start:
 kolla_bifrost_dhcp_pool_end:
diff --git a/ansible/roles/kolla-bifrost/templates/bifrost.yml.j2 b/ansible/roles/kolla-bifrost/templates/bifrost.yml.j2
index eb5cf82a2..8ffbf2af8 100644
--- a/ansible/roles/kolla-bifrost/templates/bifrost.yml.j2
+++ b/ansible/roles/kolla-bifrost/templates/bifrost.yml.j2
@@ -2,6 +2,12 @@
 # List of enabled Ironic hardware types.
 enabled_hardware_types: "{{ kolla_bifrost_enabled_hardware_types | join(',') }}"
 
+{% if kolla_bifrost_extra_kernel_options %}
+# List of extra kernel parameters for Bifrost's Ironic PXE configuration.
+# Default is empty.
+extra_kernel_options: "{{ kolla_bifrost_extra_kernel_options }}"
+{% endif %}
+
 # IP address range for DHCP.
 dhcp_pool_start: "{{ kolla_bifrost_dhcp_pool_start }}"
 dhcp_pool_end: "{{ kolla_bifrost_dhcp_pool_end }}"
diff --git a/doc/source/configuration/bifrost.rst b/doc/source/configuration/bifrost.rst
index 98c5cc7f4..a74554f58 100644
--- a/doc/source/configuration/bifrost.rst
+++ b/doc/source/configuration/bifrost.rst
@@ -187,6 +187,10 @@ container.
 ``kolla_bifrost_enabled_hardware_types``
     List of :ironic-doc:`hardware types <admin/drivers>` to enable for
     Bifrost's Ironic. Default is ``["ipmi"]``.
+``kolla_bifrost_extra_kernel_options``
+    List of :ironic-doc:`extra kernel parameters
+    <install/advanced.html#appending-kernel-parameters-to-boot-instances>` for
+    Bifrost's Ironic PXE configuration.  Default is none.
 
 Ironic Inspector configuration
 ==============================
diff --git a/etc/kayobe/bifrost.yml b/etc/kayobe/bifrost.yml
index 61710b5e4..4a99c3541 100644
--- a/etc/kayobe/bifrost.yml
+++ b/etc/kayobe/bifrost.yml
@@ -54,6 +54,10 @@
 # List of hardware types to enable for Bifrost's Ironic.
 #kolla_bifrost_enabled_hardware_types:
 
+# List of extra kernel parameters for Bifrost's Ironic PXE configuration.
+# Default is empty.
+#kolla_bifrost_extra_kernel_options:
+
 ###############################################################################
 # Ironic Inspector configuration.
 
diff --git a/releasenotes/notes/bifrost-ironic-extra-kernel-params-e3e56a9dcdf24bb6.yaml b/releasenotes/notes/bifrost-ironic-extra-kernel-params-e3e56a9dcdf24bb6.yaml
new file mode 100644
index 000000000..0650b532b
--- /dev/null
+++ b/releasenotes/notes/bifrost-ironic-extra-kernel-params-e3e56a9dcdf24bb6.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Adds a new configuration variable, ``kolla_bifrost_extra_kernel_options``,
+    which allows to provide a list of extra kernel parameters for Bifrost's
+    Ironic PXE configuration. It defaults to an empty list. See `story 2001987
+    <https://storyboard.openstack.org/#!/story/2001987>`__ for details.