From af5fc8ae964090ffc47dadc840837849d72ab71a 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 (cherry picked from commit feb15af75b1d38fdfa2c670c55a6d0f4c95c5ad7) --- .../kvm/nova_compute_kvm_virsh_net_remove.yml | 12 ++++++------ 1 file changed, 6 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 3ab2330d..d4f77938 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,16 @@ # 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 + failed_when: (default_net_info.rc != 0) and ('Network not found' not in default_net_info.stderr) + register: default_net_info - name: Disable libvirt default network 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 command: "virsh net-destroy default" - when: default_net.stdout.find('default') != -1 + when: default_net_info.stdout | regex_search('Active:\s+yes')