From 748486e2eafcd380c3d84763a10071fd9fece995 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Mon, 11 Nov 2024 12:20:53 +0000 Subject: [PATCH] Bump version of MichaelRigart.interfaces The newer version sets the connection.autoconnect-slaves=1 config option[1]. This will ensure that slave interfaces will also reconnect after bouncing the parent. [1] https://github.com/michaelrigart/ansible-role-interfaces/releases/tag/v1.15.1 Closes-Bug: #2072340 Change-Id: I2d7a8f1368d4f0e02d199029c15c453a56582b41 (cherry picked from commit 447635ac5448e0d5d6c6f34a7e5a44f298e266aa) --- dev/functions | 21 ++++++++++++++++++- dev/overcloud-test-bounce-interface.sh | 21 +++++++++++++++++++ .../run.yml | 10 +++++++++ ...ave-interface-bounce-81d8dc8e5e474447.yaml | 6 ++++++ requirements.yml | 2 +- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100755 dev/overcloud-test-bounce-interface.sh create mode 100644 releasenotes/notes/fixes-slave-interface-bounce-81d8dc8e5e474447.yaml diff --git a/dev/functions b/dev/functions index 5afaffc87..8ae87da68 100644 --- a/dev/functions +++ b/dev/functions @@ -274,7 +274,7 @@ function environment_setup { function run_kayobe { # Run a kayobe command, including extra arguments provided via # $KAYOBE_EXTRA_ARGS. - kayobe ${KAYOBE_EXTRA_ARGS} $* + kayobe ${KAYOBE_EXTRA_ARGS} "${@}" } function control_host_bootstrap { @@ -593,6 +593,25 @@ function overcloud_test_init { fi } +function overcloud_test_bounce_interface { + shift + LIMIT=$1 + INTERFACE=$2 + + environment_setup + + # Change current configuration so that a subsequent host configure will bounce the interfaces: + if is_dnf; then + # Rocky + run_kayobe overcloud host command run -b --command "rm -f /etc/NetworkManager/system-connections/$INTERFACE.nmconnection" --limit "$LIMIT" + else + # Ubuntu + run_kayobe overcloud host command run -b --command "rm -f /etc/systemd/network/50-kayobe-$INTERFACE.network" --limit "$LIMIT" + fi + # Trigger bounce + run_kayobe overcloud host configure -t network +} + function overcloud_test { set -eu diff --git a/dev/overcloud-test-bounce-interface.sh b/dev/overcloud-test-bounce-interface.sh new file mode 100755 index 000000000..c797cdf41 --- /dev/null +++ b/dev/overcloud-test-bounce-interface.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# Bounces a given interface on hosts matching the supplied limit. +# Positional arguments: +# arg0: Ansible limit +# arg1: Interface to bounce + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + config_init + overcloud_test_bounce_interface controllers "${@}" +} + +main "${@:1}" diff --git a/playbooks/kayobe-overcloud-host-configure-base/run.yml b/playbooks/kayobe-overcloud-host-configure-base/run.yml index 38e41494c..bca6bc7f4 100644 --- a/playbooks/kayobe-overcloud-host-configure-base/run.yml +++ b/playbooks/kayobe-overcloud-host-configure-base/run.yml @@ -10,6 +10,11 @@ testinfra_venv: ~/testinfra-venv test_path: "{{ kayobe_src_dir }}/playbooks/kayobe-overcloud-host-configure-base/tests/" tasks: + - name: Prevent NetworkManager from managing default interface + command: 'nmcli dev set {{ ansible_facts.default_ipv4.interface }} managed no' + become: true + when: ansible_facts.os_family == 'RedHat' + - name: Ensure overcloud is deployed shell: cmd: "{{ kayobe_src_dir }}/dev/overcloud-deploy.sh &> {{ logs_dir }}/ansible/overcloud-deploy" @@ -29,3 +34,8 @@ command: "{{ testinfra_venv }}/bin/py.test {{ test_path }} --html={{ logs_dir }}/test-results.html --self-contained-html" environment: SITE_MIRROR_FQDN: "{{ zuul_site_mirror_fqdn }}" + + - name: Test bouncing interfaces + shell: + cmd: "{{ kayobe_src_dir }}/dev/overcloud-test-bounce-interface.sh controllers br1 &> {{ logs_dir }}/ansible/overcloud-test-bounce-interface" + executable: /bin/bash diff --git a/releasenotes/notes/fixes-slave-interface-bounce-81d8dc8e5e474447.yaml b/releasenotes/notes/fixes-slave-interface-bounce-81d8dc8e5e474447.yaml new file mode 100644 index 000000000..6875a6429 --- /dev/null +++ b/releasenotes/notes/fixes-slave-interface-bounce-81d8dc8e5e474447.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue where slave interfaces would not be brought back up when + bouncing the master interface. + `LP#2072340 `_. diff --git a/requirements.yml b/requirements.yml index 0dfd7d599..a934c95bd 100644 --- a/requirements.yml +++ b/requirements.yml @@ -27,7 +27,7 @@ roles: # There are no versioned releases of this role. version: acd08fd126d0e442ab8b3bc518e37761390d8c2f - src: MichaelRigart.interfaces - version: v1.14.4 + version: v1.15.1 - src: mrlesmithjr.chrony version: v0.1.4 - src: mrlesmithjr.manage_lvm