From 420df0153e9a34c6787043caffb28380444cc07e Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Mon, 20 Aug 2018 09:42:33 +0100 Subject: [PATCH] Ensure that tests fail early if network interfaces are down Interfaces such as eth12 are required to be working for functional tests such as healthcheck/tempest, and we waste a lot of CI time when these interfaces do not come up properly during host preparation. This change makes the build fail if either: * The network bridges do not come up after creation * The new interfaces eth12/13/14 are not up after host bootstrap Change-Id: Idf83b48beab29e9044fbc0e6d4eacc89f68bf18f --- tests/bootstrap-aio.yml | 7 ++++++ .../tasks/prepare_networking.yml | 22 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap-aio.yml b/tests/bootstrap-aio.yml index d342aa9ef1..3df5a69ff6 100644 --- a/tests/bootstrap-aio.yml +++ b/tests/bootstrap-aio.yml @@ -74,6 +74,13 @@ MaxStartups: "100:100:100" GSSAPIAuthentication: no GSSAPICleanupCredentials: no + post_tasks: + - name: Check that new network interfaces are up + assert: + that: + - ansible_eth12['active'] == true + - ansible_eth13['active'] == true + - ansible_eth14['active'] == true vars_files: - "{{ playbook_dir }}/../playbooks/defaults/repo_packages/openstack_services.yml" - vars/bootstrap-aio-vars.yml diff --git a/tests/roles/bootstrap-host/tasks/prepare_networking.yml b/tests/roles/bootstrap-host/tasks/prepare_networking.yml index cebe775cd1..e10efd089c 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_networking.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_networking.yml @@ -197,6 +197,26 @@ tags: - network-config +# NOTE(jrosser) The systemd_networkd role uses a handler to restart the networking service +# This will normally not run until the end of the play, so we must force it here +- name: Force systemd_networkd hander to run + meta: flush_handlers + +# NOTE(jrosser) The intention here is not to proceed further until the network bridges are up +# This ensures there will be no race between the bridges coming up and subsequent tasks which +# require functional network interfaces +- name: Check that network bridges are up + wait_for: + port: 22 + timeout: 30 + host: "{{ item }}" + with_items: + - 172.29.236.100 # br-mgmt + - 172.29.244.100 # br-storage + - 172.29.232.100 # br-dbaas + - 172.29.252.100 # br-lbaas + - 172.29.240.100 # br-vxlan + - name: Run the systemd service role include_role: name: systemd_service @@ -241,6 +261,6 @@ - name: Updating the facts due to net changes setup: - filter: "ansible_br*" + gather_subset: network tags: - networking