tripleo container's healthcehck fails in undercloud with no_proxy and IPv6 env

Bug #2004268 reported by Nozomi Kawamoto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Undecided
Nozomi Kawamoto

Bug Description

Description
==================
In the case that the undercloud is installed with IPv6 and the no_proxy environment variable is set, healthcheck of some tripleo containers fails.

The helathcheck raise an exception `ValueError: too many values to unpack (expected 2)`.
https://paste.opendev.org/show/bFRigE58DyqRTtiGzQ5i/

It's because the socket.getpeername() in python return a tuple that includes 4 values in IPv6 connections but only 2 values in IPv4 connections.

https://docs.python.org/3/library/socket.html#socket-families
~~~
For AF_INET6 address family, a four-tuple (host, port, flowinfo, scope_id) is used, where flowinfo and scope_id represent the sin6_flowinfo and sin6_scope_id members in struct sockaddr_in6 in C. For socket module methods, flowinfo and scope_id can be omitted just for backward compatibility. Note, however, omission of scope_id can cause problems in manipulating scoped IPv6 addresses.
~~~

https://docs.python.org/3/library/socket.html#socket.socket.getpeername
~~~
socket.getpeername()
Return the remote address to which the socket is connected. This is useful to find out the port number of a remote IPv4/v6 socket, for instance. (The format of the address returned depends on the address family — see above.) On some systems this function is not supported.
~~~

Therefore I guess below line have to be supported for IPv6.
https://github.com/openstack/tripleo-common/blob/stable/wallaby/healthcheck/http-healthcheck.py#L33

Steps to reproduce
==================
1. Define no_proxy environment variable in /etc/environment on director node.
2. Install undercloud with IPv6.
3. Execute healthcheck script in an one of `unhealthy` containers.
     $ sudo podman exec --user root keystone /openstack/healthcheck

Expected result
==================
Completing the healthcheck without any errors.

Actual result
==================
The healthcheck fails and the some container's health status become `unhealthy`.

Environment
==================
- RHOSP 17.0.1(Wallaby)
- RHEL 9.0(Plow)
- openstack-tripleo-common-containers-15.4.1-0.20221208160327.51f6577.el9ost.noarch
- python3-tripleo-common-15.4.1-0.20221208160327.51f6577.el9ost.noarch
- openstack-tripleo-common-15.4.1-0.20221208160327.51f6577.el9ost.noarch

Logs & Configs
==================
N/A

Changed in tripleo:
assignee: nobody → Nozomi Kawamoto (nkawamot)
tags: added: tripleo-common
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)
Changed in tripleo:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-common/+/872316
Committed: https://opendev.org/openstack/tripleo-common/commit/f15417d662f9119c04d3cab85d5c807b36d8fa8f
Submitter: "Zuul (22348)"
Branch: master

commit f15417d662f9119c04d3cab85d5c807b36d8fa8f
Author: Nozomi Kawamoto <email address hidden>
Date: Tue Jan 31 22:13:00 2023 +0900

    Support IPv6 for HTTP request

    This http-healthcheck always fails in the case the request is against to
    IPv6 address.

    Usually, the socket in IPv6 return a tuple that contains four values but
    only two values in IPv4.

    Currently, only two variables are defined to store return values.
    Therefore when extract the return value of socket.getpeername() in IPv6,
    an ValueError exception is raised and then healthcheck fails.

    This change restrict the return value of the socket.getpeername() to
    return only first two elements regardless of IPv4/IPv6.

    Closes-Bug: #2004268
    Change-Id: I57ae54518a86f93ec92f0e74efadf1fa4da29f0f

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (stable/zed)

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/tripleo-common/+/872629

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/tripleo-common/+/872635

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-common/+/872637

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-common (stable/zed)

Change abandoned by "Takashi Kajinami <email address hidden>" on branch: stable/zed
Review: https://review.opendev.org/c/openstack/tripleo-common/+/872629
Reason: zed is no longer maintained

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/tripleo-common/+/872635
Committed: https://opendev.org/openstack/tripleo-common/commit/1f6d9d0dd46a82e77b4a80d1307319294e6169aa
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 1f6d9d0dd46a82e77b4a80d1307319294e6169aa
Author: Nozomi Kawamoto <email address hidden>
Date: Tue Jan 31 22:13:00 2023 +0900

    Support IPv6 for HTTP request

    This http-healthcheck always fails in the case the request is against to
    IPv6 address.

    Usually, the socket in IPv6 return a tuple that contains four values but
    only two values in IPv4.

    Currently, only two variables are defined to store return values.
    Therefore when extract the return value of socket.getpeername() in IPv6,
    an ValueError exception is raised and then healthcheck fails.

    This change restrict the return value of the socket.getpeername() to
    return only first two elements regardless of IPv4/IPv6.

    Closes-Bug: #2004268
    Change-Id: I57ae54518a86f93ec92f0e74efadf1fa4da29f0f
    (cherry picked from commit f15417d662f9119c04d3cab85d5c807b36d8fa8f)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-common (stable/train)

Change abandoned by "Elod Illes <email address hidden>" on branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-common/+/872637
Reason: Train is about to transition to End of Life. Open patches needs to be abandoned before branch deletion.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.