From d271e705b94f0f82a14dead99c6fe660ea077de8 Mon Sep 17 00:00:00 2001
From: Maksim Malchuk <maksim.malchuk@gmail.com>
Date: Thu, 17 Mar 2022 20:29:39 +0300
Subject: [PATCH] Fix Bifrost inspection through DHCP-relay

This is continue of the changes to support Ironic/Bifrost provision
through DHCP-relay same as I9488a72db588e31289907668f1997596a8ccdec6

Depends-On: I74af38dc555b7edee8331e31dfd1a2fbfe4f1151
Change-Id: Ie1d5ecf32c637b77757e56fbe2fae1ff7c0bf000
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
---
 ansible/kolla-bifrost.yml                                    | 1 +
 ansible/roles/kolla-bifrost/defaults/main.yml                | 1 +
 .../kolla-bifrost/templates/kolla/config/bifrost/bifrost.yml | 1 +
 .../notes/bifrost-dhcp-range-netmask-fd40642967042267.yaml   | 5 +++++
 4 files changed, 8 insertions(+)
 create mode 100644 releasenotes/notes/bifrost-dhcp-range-netmask-fd40642967042267.yaml

diff --git a/ansible/kolla-bifrost.yml b/ansible/kolla-bifrost.yml
index 4ddda432..acda1064 100644
--- a/ansible/kolla-bifrost.yml
+++ b/ansible/kolla-bifrost.yml
@@ -9,6 +9,7 @@
       # Network configuration.
       kolla_bifrost_dhcp_pool_start: "{{ provision_oc_net_name | net_inspection_allocation_pool_start }}"
       kolla_bifrost_dhcp_pool_end: "{{ provision_oc_net_name | net_inspection_allocation_pool_end }}"
+      kolla_bifrost_dhcp_pool_mask: "{{ provision_oc_net_name | net_mask }}"
       kolla_bifrost_dnsmasq_router: "{{ provision_oc_net_name | net_inspection_gateway or provision_oc_net_name | net_gateway }}"
       kolla_bifrost_dnsmasq_dns_servers: "{{ resolv_nameservers | default([]) }}"
       kolla_bifrost_domain: "{{ resolv_domain | default }}"
diff --git a/ansible/roles/kolla-bifrost/defaults/main.yml b/ansible/roles/kolla-bifrost/defaults/main.yml
index 93dfc35c..ae2e5fa4 100644
--- a/ansible/roles/kolla-bifrost/defaults/main.yml
+++ b/ansible/roles/kolla-bifrost/defaults/main.yml
@@ -30,6 +30,7 @@ kolla_bifrost_extra_kernel_options: []
 # IP address range for DHCP.
 kolla_bifrost_dhcp_pool_start:
 kolla_bifrost_dhcp_pool_end:
+kolla_bifrost_dhcp_pool_mask:
 
 # Default route provided to nodes via DHCP.
 kolla_bifrost_dnsmasq_router:
diff --git a/ansible/roles/kolla-bifrost/templates/kolla/config/bifrost/bifrost.yml b/ansible/roles/kolla-bifrost/templates/kolla/config/bifrost/bifrost.yml
index e8accf4f..7ec8bf87 100644
--- a/ansible/roles/kolla-bifrost/templates/kolla/config/bifrost/bifrost.yml
+++ b/ansible/roles/kolla-bifrost/templates/kolla/config/bifrost/bifrost.yml
@@ -11,6 +11,7 @@ extra_kernel_options: "{{ kolla_bifrost_extra_kernel_options if kolla_bifrost_ex
 # IP address range for DHCP.
 dhcp_pool_start: "{{ kolla_bifrost_dhcp_pool_start }}"
 dhcp_pool_end: "{{ kolla_bifrost_dhcp_pool_end }}"
+dhcp_pool_mask: "{{ kolla_bifrost_dhcp_pool_mask }}"
 
 {% if kolla_bifrost_dnsmasq_router %}
 # Default route provided to nodes via DHCP.
diff --git a/releasenotes/notes/bifrost-dhcp-range-netmask-fd40642967042267.yaml b/releasenotes/notes/bifrost-dhcp-range-netmask-fd40642967042267.yaml
new file mode 100644
index 00000000..4083af8c
--- /dev/null
+++ b/releasenotes/notes/bifrost-dhcp-range-netmask-fd40642967042267.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Ironic inspection through Bifrost now work even if DHCP-relay is used.
+    The dhcp-range in dnsmasq.conf corrctly configured with network mask.
-- 
GitLab