simple-init: allow for NetworkManager support

This plumbs through an "--use-nm" flag to glean which instructs it to
setup interface bringup with NetworkManager rather than legacy network
enablement scripts.

In this case, install the NetworkManager package.  In the non-nm case,
also install the network-scripts for Fedora 29 -- this has stopped
being installed by default (it's been deprecated since forever).

As noted in the docs, this is currently really only relevant on the
supported rpm distros which are using the ifcfg-rh NetworkManager
plugin to effectively re-use old config files.  However,
NetworkManager has similar plugins for other platforms, so support can
be expanded if changes are proposed.

Depends-On: https://review.openstack.org/618964
Change-Id: I4d76e88ce25e5675fd5ef48924acd09915a62a4b
This commit is contained in:
Ian Wienand 2018-11-21 10:36:12 +11:00
parent c52c383f1b
commit 8ec3750dda
7 changed files with 42 additions and 6 deletions

View File

@ -58,3 +58,13 @@ Then set your DIB env vars like this before running DIB::
DIB_INSTALLTYPE_simple_init=repo
DIB_REPOLOCATION_glean=/tmp/glean
DIB_REPOREF_glean=my-test-ref
NetworkManager
--------------
By default, this uses the "legacy" scripts on each platform. To use
NetworkManager instead, set ``DIB_SIMPLE_INIT_NETWORKMANAGER`` to
non-zero. See the glean documentation for what the implications for
this are on each platform.
This is currently only implemented for CentOS and Fedora platforms.

View File

@ -0,0 +1 @@
export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0}

View File

@ -24,4 +24,9 @@ SCRIPTDIR=$(dirname $0)
# Ensure the 8021q module is loaded so that glean can support tagged interfaces
echo "8021q" >> /etc/modules
glean-install
enable_nm=""
if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 0 ]]; then
enable_nm="--use-nm"
fi
glean-install ${enable_nm}

View File

@ -1,3 +1,7 @@
dhcp-client:
net-tools:
ifupdown:
network-scripts:
when: DIB_SIMPLE_INIT_NETWORKMANAGER = 0
NetworkManager:
when: DIB_SIMPLE_INIT_NETWORKMANAGER != 0

View File

@ -5,7 +5,8 @@
},
"debian": {
"dhcp-client": "isc-dhcp-client",
"ifupdown": "ifupdown"
"ifupdown": "ifupdown",
"NetworkManager": "network-manager"
},
"gentoo": {
"dhcp-client": "net-misc/dhcp",
@ -16,8 +17,16 @@
"dhcp-client": "dhcp-client"
}
},
"release": {
"fedora": {
"29": {
"network-scripts": "network-scripts"
}
}
},
"default": {
"dhcp-client": "isc-dhcp-client",
"ifupdown": ""
"ifupdown": "",
"network-scripts": ""
}
}

View File

@ -13,9 +13,11 @@ case "$DIB_INIT_SYSTEM" in
;;
systemd)
if [[ ${DISTRO_NAME} =~ (centos|rhel7|fedora) ]]; then
# NOTE(pabelanger): Glean requires network.service for
# these platforms.
systemctl enable network.service
if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 1 ]]; then
# NOTE(pabelanger): Glean requires network.service for
# these platforms when not using networkmanager
systemctl enable network.service
fi
elif [[ ${DISTRO_NAME} =~ (opensuse) ]]; then
# on suse, this is named wicked.service, but it's the same
# as network.service.

View File

@ -0,0 +1,5 @@
---
features:
- |
The `simple-init` element can now use NetworkManager instead of
legacy scripts on Red Hat platforms.