Compare commits

..

10 Commits

Author SHA256 Message Date
39cc72476a make apache services truly dual socket
Some checks failed
Check Release Manifest Local Charts Versions / Check Release Manifest Local Charts Versions (pull_request) Successful in 9s
Build PR in OBS / Build PR in OBS (pull_request_target) Failing after 3h3m19s
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 16:24:06 +00:00
e58b9de61c let ironic API use v4 and v6 sockets
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 16:24:06 +00:00
65f482ea85 simplify the definition of host_ip on ironic 2025-07-25 16:24:06 +00:00
21270fdb09 Use my_ipv6 when IRONIC_IPV6 is defined
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 16:24:06 +00:00
8449a9cb3f Introduce hostname
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 16:24:06 +00:00
ddcd99f38c Introduce IRONIC_IPV6 to bind on IPv6 sockets
The ironic scripts either use PROVISIONING_IP as an input or try to
determine an IP address to bind the sockets to. This results in
IRONIC_IP being defined once the process is complete, and it can carry
either an IPv4 or an IPv6 address.

Likely, the assumption is that on Linux, by default, IPv4-mapped IPv6
addresses can be leveraged to serve both IPv4 and IPv6 through a single
socket. However this is not a good practice and two separate sockets
should be used instead, whenever possible.

This change modifies such logic by
- introducing the variable IRONIC_IPV6 alongside the existing
- matching IRONIC_IP and attempting to populate both variables

Please note that hostname based URLs, with both A and AAAA records, are
also required for a fully working dual-stack configuration.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 15:42:17 +00:00
341c04f2eb Revert 2742439 being now redundant
Commit 2742439 added logic to tentatively identify the interface name
in get_provisioning_interface if the PROVISIONING_IP is provided.
However the same process in then repeated in wait_for_interface_or_ip.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 15:35:44 +00:00
c9eadad2a7 Leverage get_interface_of_ip to find PROVISIONING_IP
Use the previously introduced get_interface_of_ip, to determine if the
PROVISIONING_IP address is actually present on a network interface.

This improves the code readability and enables additional debugging
output.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 15:35:44 +00:00
1cb85293e1 Add two new utility functions for later refactoring
The way the ironic-image processes are bound to internet sockets is mainly
by PROVISIONING_IP or PROVISIONING_INTERFACE, that is, by looking up a
specific address on an interface, or a specific interface for a workable
address.

Introduce two new utility functions in ironic-common.sh for these two
purposes:
get_interface_of_ip: returns the name of the interface where the IP address
                     provided as argument is found
get_ip_of_interface: returns the first IP associated to the interface
                     provided as argument

These two functions will be put into use in subsequent commits.

Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 14:25:24 +00:00
ff29574a35 make tests more reliable
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
2025-07-25 14:25:18 +00:00

View File

@@ -122,8 +122,6 @@ get_provisioning_interface()
return
fi
local interface="provisioning"
for mac in ${PROVISIONING_MACS//,/ }; do
if ip -br link show up | grep -i "$mac" &>/dev/null; then
interface="$(ip -br link show up | grep -i "$mac" | cut -f 1 -d ' ' | cut -f 1 -d '@')"
@@ -146,33 +144,48 @@ wait_for_interface_or_ip()
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
# for an IP
if [[ -n "${PROVISIONING_IP}" ]]; then
echo "${FUNCNAME}: Lookup by PROVISIONING_IP"
local IFACE_OF_IP=""
until [[ -z $IFACE_OF_IP ]]; do
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface"
until [[ -n "$IFACE_OF_IP" ]]; do
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface..."
IFACE_OF_IP="$(get_interface_of_ip $PROVISIONING_IP)"
sleep 1
done
# Add some debugging output
echo "Found $PROVISIONING_IP on interface $IFACE_OF_IP"
echo "Found $PROVISIONING_IP on interface \"${IFACE_OF_IP}\"!"
export PROVISIONING_INTERFACE="$IFACE_OF_IP"
# If the IP contains a colon, then it's an IPv6 address
# If the IP contains a colon, then it's an IPv6 address
if [[ "$PROVISIONING_IP" =~ .*:.* ]]; then
export IRONIC_IPV6="$PROVISIONING_IP"
else
export IRONIC_IP="$PROVISIONING_IP"
fi
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
until [[ -n "$IRONIC_IPV6" ]] || [[ -n "$IRONIC_IP" ]]; do
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured..."
export IRONIC_IPV6="$(get_ip_of_interface $PROVISIONING_INTERFACE 6)"
sleep 1
export IRONIC_IP="$(get_ip_of_interface $PROVISIONING_INTERFACE 4)"
sleep 1
done
if [[ -n "$IRONIC_IPV6" ]]; then
echo "Found $IRONIC_IPV6 on interface \"${PROVISIONING_INTERFACE}\"!"
fi
if [[ -n "$IRONIC_IP" ]]; then
echo "Found $IRONIC_IP on interface \"${PROVISIONING_INTERFACE}\"!"
fi
elif [[ -n "$IRONIC_URL_HOSTNAME" ]]; then
echo "${FUNCNAME}: Lookup by IRONIC_URL_HOSTNAME"
local IPV6_IFACE=""
local IPV4_IFACE=""
# we should get at least one IP address
until [[ -z "$IFACE_IPV6" ]] && [[ -z "$IFACE_IPV4" ]]; do
while [[ -z "$IPV6_IFACE" ]] && [[ -z "$IPV4_IFACE" ]]; do
local IPV6_RECORD=""
local IPV4_RECORD=""
local IPV6_IFACE=""
local IPV4_IFACE=""
local IPV4_RECORD=""
IPV6_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 6)"
IPV4_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 4)"
@@ -194,10 +207,10 @@ wait_for_interface_or_ip()
# Add some debugging output
if [[ -n "$IPV6_IFACE" ]]; then
echo "Found $IPV6_RECORD on interface $IPV6_IFACE"
echo "Found $IPV6_RECORD on interface \"${IPV6_IFACE}\"!"
fi
if [[ -n "$IPV4_IFACE" ]]; then
echo "Found $IPV4_RECORD on interface $IPV4_IFACE"
echo "Found $IPV4_RECORD on interface \"${IPV4_IFACE}\"!"
fi
# Make sure both IPs are asigned to the same interface
@@ -208,25 +221,6 @@ wait_for_interface_or_ip()
export IRONIC_IP="$IPV4_RECORD"
export IRONIC_IPV6="$IPV6_RECORD"
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
echo "${FUNCNAME}: Lookup by PROVISIONING_INTERFACE"
until [[ -z "$IRONIC_IPV6" ]] && [[ -z "$IRONIC_IP" ]]; do
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured"
export IRONIC_IPV6="$(get_ip_of_interface $PROVISIONING_INTERFACE 6)"
sleep 1
export IRONIC_IP="$(get_ip_of_interface $PROVISIONING_INTERFACE 4)"
sleep 1
done
# Add some debugging output
if [[ -n "$IRONIC_IPV6" ]]; then
echo "Found $IRONIC_IPV6 on interface $PROVISIONING_INTERFACE"
fi
if [[ -n "$IRONIC_IP" ]]; then
echo "Found $IRONIC_IP on interface $PROVISIONING_INTERFACE"
fi
else
echo "Cannot determine an interface or an IP for binding and creating URLs"
return 1
@@ -243,8 +237,6 @@ wait_for_interface_or_ip()
export IRONIC_URL_HOST="[$IRONIC_IPV6]" # The HTTP host needs surrounding with brackets
fi
echo "IRONIC_IP=${IRONIC_IP} - IRONIC_IPV6=${IRONIC_IPV6}"
# Once determined if we have IPv4 and/or IPv6, override the hostname if provided
if [[ -n "$IRONIC_URL_HOSTNAME" ]]; then
IRONIC_URL_HOST=$IRONIC_URL_HOSTNAME