From 2ab916d6d1bf39a9efd2842bf110a3be697216e2 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 13 Jan 2017 17:44:01 +0000 Subject: [PATCH] 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 --- .../roles/bifrost-create-vm-nodes/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index 917c47534..bc86c7fb3 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -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