From cbe1a0fc6baf63bda96fa67834f7d4aff6435223 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 3 Oct 2019 00:19:19 +0000 Subject: [PATCH] simple-init: default to NetworkManager for CentOS and Fedora NetworkManager with simple-init has proven to be stable in OpenStack infra, switch to it by default for CentOS and Fedora. For CentOS 8 and Fedora, add a check to make it the only option. Thus only CenOS 7 remains optionally using the legacy scripts; this is likely not used anywhere (infra is really the primary user, where NetworkManager is already used); we can likely remove this variable (and hence path) in a future cleanup. In the setup, remove rhel7 element which was never really tested. Reorganise the fallthrough to call out the default paths as doing nothing. Change-Id: Ic996956da4b85f7d95179b8df9881d5f52c091af --- .zuul.d/jobs.yaml | 6 ------ .../environment.d/15-simple-init-networkmanager | 13 ++++++++++++- .../simple-init/post-install.d/80-simple-init | 6 +++++- .../notes/simple-init-nm-5d19e249c0a4560b.yaml | 6 ++++++ 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index 4db297fb..fd743b44 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -223,8 +223,6 @@ base_element: centos-minimal release: '7' mirror: "http://{{ zuul_site_mirror_fqdn }}/centos" - env-vars: - DIB_SIMPLE_INIT_NETWORKMANAGER: '1' - job: name: dib-nodepool-functional-openstack-fedora-29-src @@ -238,8 +236,6 @@ nodepool_diskimage: base_element: fedora-minimal release: '29' - env-vars: - DIB_SIMPLE_INIT_NETWORKMANAGER: '1' - job: name: dib-nodepool-functional-openstack-fedora-30-src @@ -253,8 +249,6 @@ nodepool_diskimage: base_element: fedora-minimal release: '30' - env-vars: - DIB_SIMPLE_INIT_NETWORKMANAGER: '1' - job: name: dib-nodepool-functional-openstack-ubuntu-trusty-src diff --git a/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager b/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager index 3aaeaa76..9dc41c1e 100644 --- a/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager +++ b/diskimage_builder/elements/simple-init/environment.d/15-simple-init-networkmanager @@ -1 +1,12 @@ -export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0} +if [[ ${DISTRO_NAME} =~ (centos|fedora) ]]; then + export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-1} +else + export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0} +fi + +if [[ ${DISTRO_NAME} == "centos" && $DIB_RELEASE -ge 8 ]] || [[ ${DISTRO_NAME} == "fedora" ]]; then + if [[ $DIB_SIMPLE_INIT_NETWORKMANAGER == 0 ]]; then + echo "simple-init only supports NetworkManager mode on Fedora and CentOS 8" + exit 1 + fi +fi diff --git a/diskimage_builder/elements/simple-init/post-install.d/80-simple-init b/diskimage_builder/elements/simple-init/post-install.d/80-simple-init index 5fcdc7ad..3acfba3e 100755 --- a/diskimage_builder/elements/simple-init/post-install.d/80-simple-init +++ b/diskimage_builder/elements/simple-init/post-install.d/80-simple-init @@ -12,7 +12,7 @@ case "$DIB_INIT_SYSTEM" in exit 0 ;; systemd) - if [[ ${DISTRO_NAME} =~ (centos|rhel7|fedora) ]]; then + if [[ ${DISTRO_NAME} == centos && ${DIB_RELEASE} -eq 7 ]]; then if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 1 ]]; then # NOTE(pabelanger): Glean requires network.service for # these platforms when not using networkmanager @@ -22,6 +22,10 @@ case "$DIB_INIT_SYSTEM" in # on suse, this is named wicked.service, but it's the same # as network.service. systemctl enable wicked.service + else + # NOTE(ianw): it might be better to whitelist platforms in + # the future, but for now assume it will "just work" + continue fi ;; openrc) diff --git a/releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml b/releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml new file mode 100644 index 00000000..bcc7cb6c --- /dev/null +++ b/releasenotes/notes/simple-init-nm-5d19e249c0a4560b.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The ``simple-init`` element will now default to using NetworkManager + for CentOS and Fedora platforms. For CentOS 8 and Fedora, the + ``DIB_SIMPLE_INIT_NETWORKMANAGER=0`` option is no longer supported.