Make sure that only IRONIC_IPV6 is set with a valid value when
PROVISIONING_IP is an IPv6 address by also clearing IRONIC_IP
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
The checks on the upstream project have reported some warnings to the
code accepted in PR #213, fix them in this commit.
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
In a dual-stack scenario, especially when deploying in direct mode via
virtual media, it might be useful to 1) use a hostname to enable "dual IP"
URLs 2) have ironic bind to those two addresses, if found on the system.
To make this possible, this commit introduces:
- a new user environment variable named IRONIC_URL_HOSTNAME, to be used
as immutable external only input, to derive IRONIC_URL_HOST and the
IP addresses to bind on
- a new utility function named "get_ip_of_hostname" to help look up the
A and AAAA records
- additional logic to look for the returned address on the system, for
binding the processes; this new logic has lower priority than
PROVISIONING_IP (which can then be used to enforce one specific IP
version) and PROVISIONING_INTERFACE
Note, while IRONIC_URL_HOSTNAME and PROVISIONING_IP are considered to be
mutually exclusive, IRONIC_URL_HOSTNAME and PROVISIONING_INTERFACE are
not.
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
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>
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>
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>
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>
Whenever PROVISIONING_INTERFACE is not set by the user, function
get_provisioning_interface attempts to determine one, or provide
"provisionign" as default value. However this can cause confusing errors
down the line.
Remove this default value and fail gracefully, with proper logging,
if the PROVISIONING_INTERFACE value is not detected.
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>
It is now possible to bring back the original directory structure for
config (/ironic-config) files and scripts (/scripts). This will make
updates to re-align with upstream easier.
Signed-off-by: Marco Chiappero <marco.chiappero@suse.com>