Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1713305

Summary: run-os-net-config.sh does not parse hostname that resolves to IPv6 address properly
Product: Red Hat OpenStack Reporter: Gurenko Alex <agurenko>
Component: openstack-tripleo-heat-templatesAssignee: Dan Sneddon <dsneddon>
Status: CLOSED ERRATA QA Contact: Gurenko Alex <agurenko>
Severity: high Docs Contact:
Priority: high    
Version: 13.0 (Queens)CC: apevec, aschultz, bdobreli, bfournie, dsneddon, hjensas, jslagle, lhh, mburns, mgeary
Target Milestone: z7Keywords: Triaged, ZStream
Target Release: 13.0 (Queens)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-heat-templates-8.3.1-28.el7ost Doc Type: Bug Fix
Doc Text:
This update adds support for validating API endpoint connectivity for hostnames with IPv6 addresses.
Story Points: ---
Clone Of:
: 1714655 (view as bug list) Environment:
Last Closed: 2019-07-10 13:05:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1714655    

Description Gurenko Alex 2019-05-23 11:09:59 UTC
Description of problem: similar issue to the https://bugzilla.redhat.com/show_bug.cgi?id=1696328, but if hostname is used that resolves to IPv6 address, then deployment fails since ping (not ping6 or ping -6) is used to ping the metadata IP and fails.


Version-Release number of selected component (if applicable): puddle 2019-05-15.1


How reproducible: 100%

Steps to Reproduce:
1.
2.
3.

Actual results:

May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping_metadata_ip                                                                                                                           [35/256]
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ get_metadata_ip
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ local METADATA_IP
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ for URL in os-collect-config.cfn.metadata_url os-collect-config.heat.auth_url os-collect-config.request.metadata_url os-collect-config.zaqar.auth_
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ os-apply-config --key os-collect-config.cfn.metadata_url --key-default '' --type raw
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ sed -e 's|http.*://\[\?\([^]]*\)]\?:.*|\1|'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ METADATA_IP=
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ '[' -n '' ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ for URL in os-collect-config.cfn.metadata_url os-collect-config.heat.auth_url os-collect-config.request.metadata_url os-collect-config.zaqar.auth_
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ os-apply-config --key os-collect-config.heat.auth_url --key-default '' --type raw
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ sed -e 's|http.*://\[\?\([^]]*\)]\?:.*|\1|'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ METADATA_IP=
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ '[' -n '' ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ for URL in os-collect-config.cfn.metadata_url os-collect-config.heat.auth_url os-collect-config.request.metadata_url os-collect-config.zaqar.auth_
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ os-apply-config --key os-collect-config.request.metadata_url --key-default '' --type raw
May 22 20:57:06 controller-0.local os-collect-config[23875]: +++ sed -e 's|http.*://\[\?\([^]]*\)]\?:.*|\1|'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ METADATA_IP=undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ '[' -n undercloud-v6 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ break
May 22 20:57:06 controller-0.local os-collect-config[23875]: ++ echo undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + local METADATA_IP=undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' -n undercloud-v6 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + is_local_ip undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + local IP_TO_CHECK=undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ip -o a
May 22 20:57:06 controller-0.local os-collect-config[23875]: + grep 'inet6\? undercloud-v6/'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + return 1
May 22 20:57:06 controller-0.local os-collect-config[23875]: + echo -n 'Trying to ping metadata IP undercloud-v6...'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + _ping=ping
May 22 20:57:06 controller-0.local os-collect-config[23875]: + [[ undercloud-v6 =~ : ]]
May 22 20:57:06 controller-0.local os-collect-config[23875]: + local COUNT=0
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=1
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 1 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=2
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 2 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=3
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 3 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=4
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 4 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=5
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 5 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 6 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=7
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 7 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=8
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 8 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=9
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 9 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + ping -c 1 undercloud-v6
May 22 20:57:06 controller-0.local os-collect-config[23875]: + COUNT=10
May 22 20:57:06 controller-0.local os-collect-config[23875]: + '[' 10 -eq 10 ']'
May 22 20:57:06 controller-0.local os-collect-config[23875]: + echo FAILURE
May 22 20:57:06 controller-0.local os-collect-config[23875]: + echo 'undercloud-v6 is not pingable.'
May 22 20:57:06 controller-0.local os-collect-config[23875]: undercloud-v6 is not pingable.

Expected results:

hostname is resolved prior to ping attempt and respective command will be used to verify connectivity

Additional info:

Comment 1 Alex Schultz 2019-05-23 17:46:50 UTC
The code from the report is in THT/network/scripts/run-os-net-config.sh

Comment 2 Dan Sneddon 2019-05-23 19:49:45 UTC
This should be fixed by this patch:

https://review.opendev.org/#/c/661095/

Once that merges upstream it will need to be backported to OSP 13. For a mitigation, you can add one line and change one line in /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh or wherever your local copy of the TripleO Heat Templates is located.

You just add the line that resolves _IP to the IP address, and you change the test to look at $_IP instead of $METADATA_IP:

 47     _ping=ping
 48     if [[ "$METADATA_IP" =~ ":" ]] ; then
 49         _ping=ping6
 50     fi

becomes:

 47     _IP="$(getent hosts $METADATA_IP | awk '{ print $1 }')"
 48     _ping=ping
 49     if [[ "$_IP" =~ ":" ]] ; then
 50         _ping=ping6
 51     fi


Diff:

diff --git a/network/scripts/run-os-net-config.sh b/network/scripts/run-os-net-config.sh
index 46532c72d..22085cabd 100755
--- a/network/scripts/run-os-net-config.sh
+++ b/network/scripts/run-os-net-config.sh
@@ -44,8 +44,9 @@ function ping_metadata_ip() {

     echo -n "Trying to ping metadata IP ${METADATA_IP}..."

+    _IP="$(getent hosts $METADATA_IP | awk '{ print $1 }')"
     _ping=ping
-    if [[ "$METADATA_IP" =~ ":" ]] ; then
+    if [[ "$_IP" =~ ":" ]] ; then
         _ping=ping6
     fi

Comment 3 Gurenko Alex 2019-05-26 08:14:21 UTC
(In reply to Dan Sneddon from comment #2)
> This should be fixed by this patch:
> 
> https://review.opendev.org/#/c/661095/
> 
> Once that merges upstream it will need to be backported to OSP 13. For a
> mitigation, you can add one line and change one line in
> /usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-
> config.sh or wherever your local copy of the TripleO Heat Templates is
> located.
> 
> You just add the line that resolves _IP to the IP address, and you change
> the test to look at $_IP instead of $METADATA_IP:
> 
>  47     _ping=ping
>  48     if [[ "$METADATA_IP" =~ ":" ]] ; then
>  49         _ping=ping6
>  50     fi
> 
> becomes:
> 
>  47     _IP="$(getent hosts $METADATA_IP | awk '{ print $1 }')"
>  48     _ping=ping
>  49     if [[ "$_IP" =~ ":" ]] ; then
>  50         _ping=ping6
>  51     fi
> 
> 
> Diff:
> 
> diff --git a/network/scripts/run-os-net-config.sh
> b/network/scripts/run-os-net-config.sh
> index 46532c72d..22085cabd 100755
> --- a/network/scripts/run-os-net-config.sh
> +++ b/network/scripts/run-os-net-config.sh
> @@ -44,8 +44,9 @@ function ping_metadata_ip() {
> 
>      echo -n "Trying to ping metadata IP ${METADATA_IP}..."
> 
> +    _IP="$(getent hosts $METADATA_IP | awk '{ print $1 }')"
>      _ping=ping
> -    if [[ "$METADATA_IP" =~ ":" ]] ; then
> +    if [[ "$_IP" =~ ":" ]] ; then
>          _ping=ping6
>      fi

Thanks a lot, Dan, with this patch, I've managed to deploy with a hostname that resolves to IPv6.

Comment 6 Bob Fournier 2019-06-07 19:09:33 UTC
Hi Alex - now that the build is available would you be able to verify this?

Comment 12 Bob Fournier 2019-06-14 20:11:49 UTC
Hi Alex - can you test this on OSP-13?  Thanks.

Comment 14 Gurenko Alex 2019-06-19 07:53:25 UTC
Verified on puddle 2019-06-13.2. Deployment with hostname that resolves to IPv6 worked smoothly.

Comment 17 errata-xmlrpc 2019-07-10 13:05:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:1738