From 80fb42760974aa093236fa543eccb260f6f58a4e Mon Sep 17 00:00:00 2001 From: Sofer Athlan-Guyot Date: Wed, 19 Nov 2025 13:45:21 +0100 Subject: [PATCH] [update] Fix IPv6 nameserver support in workload launch script The workload launch script fails on IPv6-only RHOSO deployments because it uses an IPv4-only regex to extract nameservers from `/etc/resolv.conf`. This causes subnet creation to fail when only IPv6 nameservers are available. Replace the regex approach with `awk`-based parsing that: - Supports both IPv4 and IPv6 addresses automatically - Only parses actual `nameserver` lines (ignores comments) - Collects all nameservers for redundancy - Provides public DNS fallback if no nameservers found - Maintains backward compatibility Closes: [OSPCIX-1114](https://issues.redhat.com/browse/OSPCIX-1114) --- roles/update/templates/workload_launch.sh.j2 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/roles/update/templates/workload_launch.sh.j2 b/roles/update/templates/workload_launch.sh.j2 index cba70bf5e2..912c089eb3 100644 --- a/roles/update/templates/workload_launch.sh.j2 +++ b/roles/update/templates/workload_launch.sh.j2 @@ -341,7 +341,19 @@ function workload_launch { ## create networking openstack network list | grep ${TENANT_NET_NAME} if [ $? -ne 0 ]; then - NAMESERVER=$(grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' /etc/resolv.conf | head -1) + # Collect all nameservers from resolv.conf + NAMESERVERS=$(awk '/^nameserver[[:space:]]/ {print $2}' /etc/resolv.conf) + + # Build DNS arguments + DNS_ARGS="" + if [ -n "$NAMESERVERS" ]; then + for ns in $NAMESERVERS; do + DNS_ARGS="$DNS_ARGS --dns-nameserver $ns" + done + else + echo "Warning: No nameservers found, using public DNS fallback" + DNS_ARGS="--dns-nameserver 8.8.8.8 --dns-nameserver 2001:4860:4860::8888" + fi echo "Creating router ${TENANT_NET_NAME}_router" os_cmd router create ${TENANT_NET_NAME}_router @@ -357,7 +369,7 @@ function workload_launch { --subnet-range 192.168.0.0/24 \ --allocation-pool start=192.168.0.10,end=192.168.0.100 \ --gateway 192.168.0.254 \ - --dns-nameserver ${NAMESERVER} \ + $DNS_ARGS \ --network ${TENANT_NET_NAME} \ ${TENANT_NET_NAME}_subnet