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 feb15af75b)
This commit is contained in:
Damian Dabrowski 2023-11-01 00:38:01 +01:00 committed by Damian Dąbrowski
parent ada7c4c1f0
commit af5fc8ae96
1 changed files with 6 additions and 6 deletions

View File

@ -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')