Merge "dhcp-all-interfaces: opt let NetworkManager doit."

This commit is contained in:
Zuul 2022-02-21 18:55:51 +00:00 committed by Gerrit Code Review
commit 53524dec59
3 changed files with 42 additions and 8 deletions

View File

@ -28,3 +28,14 @@ DIB_DHCP_TIMEOUT
will wait to get an address. Should be increased in networks such as
Infiniband.
:Example: DIB_DHCP_TIMEOUT=300
DIB_DHCP_NETWORK_MANAGER_AUTO
:Required: No
:Default: false
:Description: When NetworkManager is detected, and this is set to true the
dhcp-all-interfaces service will not be installed. Only the NetworkManager
configuration will be added. NetworkManager is quite capable to do automatic
interface configuration. NetworkManager will by default try to
auto-configure any interface with no configuration, it will use DHCP for
IPv4 and Router Advertisements to decide how to initialize IPv6.
:Example: DIB_DHCP_NETWORK_MANAGER_AUTO=true

View File

@ -9,14 +9,6 @@ set -o pipefail
SCRIPTDIR=$(dirname $0)
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
@ -31,6 +23,22 @@ 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
if [ "${DIB_DHCP_NETWORK_MANAGER_AUTO:-false}" == true ]; then
# Use NetworkManager for auto configuration, it will behave just as
# good as dhcp-all-interfaces.sh in most cases.
exit 0
fi
fi
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
fi

View File

@ -0,0 +1,15 @@
---
features:
- |
It is now possible to configure the dhcp-all-interfaces element not to
install the dhcp-all-interfaces service on systems with NetworkManager.
NetworkManager is quite capable to do automatic interface configuration.
NetworkManager will by default try to auto-configure any interface with
no configuration, it will use DHCP for IPv4 and Router Advertisements to
decide how to initialize IPv6.
The new environment variable ``DIB_DHCP_NETWORK_MANAGER_AUTO`` (defauls to:
``false``) has been added, when set to ``true`` only the configuration for
NetworkManager is written.