Workaround for network start race condition

Add a workaround for the libvirt network start race condition bug. In
some cases the libvirt default network starts in an inactive state
with the bridge interface down. Trying to start the network via libvirt
fails because the network interface already exists. This condition is
checked for and ignored but causes the Bifrost deployment test to fail
later when templating ironic.conf as the configured network interface
has no IP address.

This change checks for the condition where the libvirt default network
is inactive and attempts to delete the associated bridge interface
before starting the libvirt network. This has been run through the CI
job and appears to resolve the issue.

Change-Id: Icb2baf0975ca3feb6041b2f2da9702ad6cc9fa06
Closes-Bug: #1660953
Related-Bug: #1650025
This commit is contained in:
Mark Goddard 2017-02-24 15:50:00 -05:00
parent 78a9bed56d
commit 9c18eeac6d
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 }}"