Handle NetworkManager for dhcp-all-interfaces

NetworkManager takes a distinctly differnet network management
approach and the bulk of the dhcp-all-interfaces code is largely
targetted at distribution specific configuration. Some which may
or may not override settings, or only partially assert desirable
settings.

As such, we need to set appropriate configuration, such as the
correct client to be used, and timeouts based upon user supplied
settings.

By default this change sets the client to be dhclient on redhat
styled machines, as the packaging default, while it works for
ramdisk usage, it does not reset the interface between retries,
which can be critical if the infrastucture operator is attempting
to configure LACP trunks to the end node.

Change-Id: I0e0cfbdbf7ef2b2861b934ccd7dab9d83a35c8f0
Story: 2008001
Task: 40648
This commit is contained in:
Julia Kreger 2020-08-11 07:57:40 -07:00
parent 1291dcba51
commit 46d12ae7d3
3 changed files with 51 additions and 2 deletions

View File

@ -8,14 +8,29 @@ set -o pipefail
SCRIPTDIR=$(dirname $0)
# TODO(hjensas): Once ndisc6 package is available in EPEL8 drop this, and add the package back in pkg-map.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1779134
if [ -e "/etc/redhat-release" ]; then
# TODO(hjensas): Once ndisc6 package is available in EPEL8 drop this,
# and add the package back in pkg-map.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1779134
if type dnf &>/dev/null; then
dnf -v -y install ndisc6 || true
else
yum -v -y install ndisc6 || true
fi
# NOTE(TheJulia): While the internal client which every networkmanager user
# should have is internal, dhclient has better behavior which includes
# shutting down the port between retries which is critical for recovery
# from LACP port blocking situations. As such, we'll force it to dhclient.
# For more information, see https://storyboard.openstack.org/#!/story/2008001
DIB_DHCP_CLIENT=${DIB_DHCP_CLIENT:-dhclient}
fi
# Sets appropriate NetworkManager configuration, if the folder is present.
if [ -x "/etc/NetworkManager" ]; then
install -D -g root -o root -m 0644 ${SCRIPTDIR}/NetworkManager-conf.d-00-main.conf /etc/NetworkManager/conf.d/00-main.conf
sed -i "s/DIB_DHCP_CLIENT/${DIB_DHCP_CLIENT:-internal}/g" /etc/NetworkManager/conf.d/00-main.conf
sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/g" /etc/NetworkManager/conf.d/00-main.conf
fi

View File

@ -0,0 +1,24 @@
# WARNING: This file has been modified by the diskimage-builder
# dhcp-all-interfaces element as this machine is likely running
# a ramdisk or needs to attempt auto-configuration on all interfaces.
[main]
# This makes sense even with dhcp on all interfaces in the event
# that the configuration has been or is being supplied via external means.
ignore-carrier=*
# Use dhclient as was done previously to the Centos8/RHEL8 RPM defaults.
# This is because dhclient shuts the interface down after a retry attempt
# which allows the link state to reset with some switches, which may be
# important for the ramdisk to recover networking.
dhcp=DIB_DHCP_CLIENT
[connection]
# Keep retrying, this is important for this important espescialy for
# ramdisks in environments where varying switch configurations may
# cause traffic to be blocked or intermittent connectivity failures
# such as those at an edge site may cause issues.
autoconnect-retries=-1
# Set the timeout. Diskimage-builder dhcp-all-interfaces has a 30
# second default. NetworkManager, by default, is 45 seconds.
# In some cases where ramdisks are in use, 60 seconds is advisable.
ipv4.dhcp-timeout=DIB_DHCP_TIMEOUT
ipv6.dhcp-timeout=DIB_DHCP_TIMEOUT

View File

@ -0,0 +1,10 @@
---
fixes:
- |
Fixes support for the ``dhcp-all-interfaces`` element when the system
networking configuration is managed via ``NetworkManager``.
- |
Fixes ``NetworkManager`` configuration with the ``dhcp-all-interfaces``
element to account for Centos8/RHEL8's default change to the
``NetworkManager`` internal DHCP client, which can introduce different
behavior for infrastucture operators such as those using LACP.