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:
parent
c7adb13973
commit
2ab916d6d1
@ -70,11 +70,23 @@
|
|||||||
- name: "Verify default network is running"
|
- name: "Verify default network is running"
|
||||||
shell: virsh net-info default |grep Active|grep -q yes
|
shell: virsh net-info default |grep Active|grep -q yes
|
||||||
register: virsh_network_status
|
register: virsh_network_status
|
||||||
|
delegate_to: localhost
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: "Start default network if not running"
|
- name: "Start default network if not running"
|
||||||
command: virsh net-start default
|
command: virsh net-start default
|
||||||
when: virsh_network_status.rc != 0
|
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"
|
- name: "Create virtual machines"
|
||||||
script: create_vm_nodes-for-role.sh
|
script: create_vm_nodes-for-role.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user