Fix race in virbr0 startup

A race can exist with the virbr0 startup where libvirt eventually
starts virbr0, but this conflicts with our expliit attempt to start
it. As such, we shoulld only attempt to start it if it makes sense
to, and tolerate failures when it appears that libvirt started the
virbr0 interface while we were not looking.

Change-Id: I804102480a0e3df6cfa97ede1213404a7db1d0fe
This commit is contained in:
Julia Kreger 2017-01-13 17:44:01 +00:00
parent c7adb13973
commit 2ab916d6d1

View File

@ -70,11 +70,23 @@
- name: "Verify default network is running"
shell: virsh net-info default |grep Active|grep -q yes
register: virsh_network_status
delegate_to: localhost
ignore_errors: yes
- name: "Start default network if not running"
command: virsh net-start default
when: virsh_network_status.rc != 0
register: task_start_default_net
ignore_errors: yes
delegate_to: localhost
- name: "Fail if default network is not available"
fail:
msg: "Unable to verify the libvirt default network is available"
when: >
virsh_network_status.rc != 0 and
task_start_default_net.rc != 0 and
'File exists' not in task_start_default_net.stderr
- name: "Create virtual machines"
script: create_vm_nodes-for-role.sh