Merge "Workaround for network start race condition"

This commit is contained in:
Jenkins 2017-02-28 15:15:16 +00:00 committed by Gerrit Code Review
commit 511825b890
2 changed files with 19 additions and 2 deletions

View File

@ -73,6 +73,12 @@
delegate_to: localhost delegate_to: localhost
ignore_errors: yes ignore_errors: yes
- name: "Delete default network interface if not running"
shell: ip link del $(virsh net-info default | awk '$1 == "Bridge:" { print $2 }')
when: virsh_network_status.rc != 0
ignore_errors: yes
delegate_to: localhost
- 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
@ -85,8 +91,7 @@
msg: "Unable to verify the libvirt default network is available" msg: "Unable to verify the libvirt default network is available"
when: > when: >
virsh_network_status.rc != 0 and virsh_network_status.rc != 0 and
task_start_default_net.rc != 0 and task_start_default_net.rc != 0
'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

View File

@ -13,6 +13,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- name: "Fail if the network interface does not exist"
fail:
msg: >
The configured network interface {{ network_interface }} does
not exist
when: "{{ 'ansible_' ~ ans_network_interface not in hostvars[inventory_hostname] }}"
- name: "Fail if the network interface has no IP address assigned"
fail:
msg: >
The configured network interface {{ network_interface }} does
not have an IP address assigned
when: "{{ not hostvars[inventory_hostname]['ansible_' ~ ans_network_interface].get('ipv4', {}).get('address') }}"
- name: "Update driver list if PXE drivers are enabled" - name: "Update driver list if PXE drivers are enabled"
set_fact: set_fact:
enabled_drivers: "{{ enabled_drivers }},{{ pxe_drivers }}" enabled_drivers: "{{ enabled_drivers }},{{ pxe_drivers }}"