From feb15af75b1d38fdfa2c670c55a6d0f4c95c5ad7 Mon Sep 17 00:00:00 2001 From: Damian Dabrowski Date: Wed, 1 Nov 2023 00:38:01 +0100 Subject: [PATCH] Always disable libvirt default network Currently, autostart for libvirt default network is disabled only when this network is active during nova playbook execution. It's an incorrect behavior because in some cases this network may not be active from the beginning. Autostart should be always disabled to ensure that this network will not be unexpectedly marked as active in the future(during package upgrade, host reboot etc.). Closes-Bug: #2042369 Change-Id: I697234bda1601b534ce1b6ab186fa98f83179ee8 --- .../drivers/kvm/nova_compute_kvm_virsh_net_remove.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tasks/drivers/kvm/nova_compute_kvm_virsh_net_remove.yml b/tasks/drivers/kvm/nova_compute_kvm_virsh_net_remove.yml index 926803b7..1447435a 100644 --- a/tasks/drivers/kvm/nova_compute_kvm_virsh_net_remove.yml +++ b/tasks/drivers/kvm/nova_compute_kvm_virsh_net_remove.yml @@ -13,16 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Check for libvirt default network - shell: "virsh net-list | awk '/default/'" +- name: Get information about libvirt default network + command: "virsh net-info default" changed_when: false - register: default_net + register: default_net_info - name: Disable libvirt default network # noqa: no-changed-when command: "virsh net-autostart default --disable" - failed_when: false - when: default_net.stdout.find('default') != -1 + when: default_net_info.stdout | regex_search('Autostart:\s+yes') - name: Destroy libvirt default network # noqa: no-changed-when command: "virsh net-destroy default" - when: default_net.stdout.find('default') != -1 + when: default_net_info.stdout | regex_search('Active:\s+yes')