diff options
-rw-r--r-- | xci/playbooks/get-opnfv-scenario-requirements.yml | 7 | ||||
-rw-r--r-- | xci/playbooks/roles/run-functest/defaults/main.yml (renamed from xci/playbooks/roles/prepare-functest/defaults/main.yml) | 0 | ||||
-rw-r--r-- | xci/playbooks/roles/run-functest/tasks/main.yml (renamed from xci/playbooks/roles/prepare-functest/tasks/main.yml) | 25 | ||||
-rw-r--r-- | xci/playbooks/roles/run-functest/templates/env.j2 (renamed from xci/playbooks/roles/prepare-functest/templates/env.j2) | 0 | ||||
-rw-r--r-- | xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 (renamed from xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2) | 7 | ||||
-rw-r--r-- | xci/playbooks/run-functest.yml (renamed from xci/playbooks/prepare-tests.yml) | 5 | ||||
-rwxr-xr-x | xci/scripts/vm/start-new-vm.sh | 16 | ||||
-rwxr-xr-x | xci/xci-deploy.sh | 14 |
8 files changed, 38 insertions, 36 deletions
diff --git a/xci/playbooks/get-opnfv-scenario-requirements.yml b/xci/playbooks/get-opnfv-scenario-requirements.yml index 7eaa43de..c04348e3 100644 --- a/xci/playbooks/get-opnfv-scenario-requirements.yml +++ b/xci/playbooks/get-opnfv-scenario-requirements.yml @@ -114,11 +114,12 @@ - set_fact: deploy_scenario_flavor: "{{ (XCI_FLAVOR in deploy_scenario_installer.flavors) | bool }}" when: + - deploy_scenario_installer is defined - deploy_scenario_installer - set_fact: deploy_scenario_distro: "{{ (XCI_DISTRO in deploy_scenario_installer.distros) | bool }}" when: - - deploy_scenario_installer + - deploy_scenario_flavor is defined - deploy_scenario_flavor when: deploy_scenario is defined @@ -135,7 +136,9 @@ - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - '' when: - - deploy_scenario is not defined or not deploy_scenario_distro + - deploy_scenario is not defined or + deploy_scenario_distro is not defined or + (deploy_scenario_distro is defined and not deploy_scenario_distro) vars: ansible_python_interpreter: "/usr/bin/python" diff --git a/xci/playbooks/roles/prepare-functest/defaults/main.yml b/xci/playbooks/roles/run-functest/defaults/main.yml index a3638302..a3638302 100644 --- a/xci/playbooks/roles/prepare-functest/defaults/main.yml +++ b/xci/playbooks/roles/run-functest/defaults/main.yml diff --git a/xci/playbooks/roles/prepare-functest/tasks/main.yml b/xci/playbooks/roles/run-functest/tasks/main.yml index 9a380cd1..3dc8e0bb 100644 --- a/xci/playbooks/roles/prepare-functest/tasks/main.yml +++ b/xci/playbooks/roles/run-functest/tasks/main.yml @@ -16,17 +16,24 @@ command: "ip addr add {{ gateway_ip_mask }} brd {{ broadcast_ip }} dev {{ gateway_interface }}" when: gateway_ip_result|failed -- name: prepare script to create networks for functest - template: - src: prepare-functest.sh.j2 - dest: /root/prepare-functest.sh - mode: 0755 - -- name: Create networks - shell: "/root/prepare-functest.sh" - - name: prepare environment file for functest template: src: env.j2 dest: /root/env mode: 0755 + +- name: prepare the script to create networks and run functest + template: + src: run-functest.sh.j2 + dest: /root/run-functest.sh + mode: 0755 + +- name: install required packages + package: + name: "{{ item }}" + state: present + with_items: + - wget + +- name: execute the script + shell: "/root/run-functest.sh" diff --git a/xci/playbooks/roles/prepare-functest/templates/env.j2 b/xci/playbooks/roles/run-functest/templates/env.j2 index 87093325..87093325 100644 --- a/xci/playbooks/roles/prepare-functest/templates/env.j2 +++ b/xci/playbooks/roles/run-functest/templates/env.j2 diff --git a/xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 b/xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 index febe8369..071dbca4 100644 --- a/xci/playbooks/roles/prepare-functest/templates/prepare-functest.sh.j2 +++ b/xci/playbooks/roles/run-functest/templates/run-functest.sh.j2 @@ -10,3 +10,10 @@ openstack --insecure subnet create --network {{ external_network }} \ --allocation-pool {{ allocation_pool }} \ --subnet-range {{ subnet_cidr }} --gateway {{ gateway_ip }} \ --no-dhcp {{ subnet_name }} + +mkdir ~/images && cd ~/images && wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img && cd ~ + +sudo docker run --env-file env \ + -v $(pwd)/openrc:/home/opnfv/functest/conf/openstack.creds \ + -v $(pwd)/images:/home/opnfv/functest/images \ + opnfv/functest-healthcheck diff --git a/xci/playbooks/prepare-tests.yml b/xci/playbooks/run-functest.yml index ee30094d..8b3b29a1 100644 --- a/xci/playbooks/prepare-tests.yml +++ b/xci/playbooks/run-functest.yml @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Setup functest installing required packages and create the public network +- name: Prepare the environment for functest and run tests hosts: opnfv + user: root roles: - - role: "prepare-functest" + - role: "run-functest" diff --git a/xci/scripts/vm/start-new-vm.sh b/xci/scripts/vm/start-new-vm.sh index 0af2a359..3048d1b9 100755 --- a/xci/scripts/vm/start-new-vm.sh +++ b/xci/scripts/vm/start-new-vm.sh @@ -112,15 +112,6 @@ if ! sudo -n "true"; then exit 1 fi -# Wait 30-120 seconds so we avoid running multiple instances of pkg manager. Of course -# this will not work as it should if there is an external process running a package -# manager instance. However, since this script is only being execute on CI nodes which -# we have complete control it should be mostly fine. -backoff_time=0 -while [[ ${backoff_time} -le 30 ]]; do - backoff_time=$(( $RANDOM % 120 )) -done - case ${ID,,} in *suse) pkg_mgr_cmd="sudo zypper -q -n install virt-manager qemu-kvm qemu-tools libvirt-daemon docker libvirt-client libvirt-daemon-driver-qemu iptables ebtables dnsmasq" @@ -133,9 +124,10 @@ case ${ID,,} in ;; esac -if pgrep -fa "${pkg_mgr_cmd%*install*}" 2>&1; then - sleep ${backoff_time} -fi +while true; do + pgrep -fa "${pkg_mgr_cmd%*install*}" 2>&1 && sleep 60 || break +done + eval ${pkg_mgr_cmd} echo "Ensuring libvirt and docker services are running..." diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index ec2598f8..18c8bb22 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -23,8 +23,9 @@ submit_bug_report() { echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" echo "xci flavor: $XCI_FLAVOR" echo "xci installer: $XCI_INSTALLER" + echo "xci scenario: $DEPLOY_SCENARIO" echo "Environment variables:" - env | grep --color=never '\(OPNFV\|XCI\|OPENSTACK\)' + env | grep --color=never '\(OPNFV\|XCI\|OPENSTACK\|SCENARIO\)' echo "-------------------------------------------------------------------------" } @@ -121,13 +122,6 @@ case ${XCI_DISTRO,,} in ;; esac -if [[ ${XCI_DISTRO,,} == centos ]]; then - echo "" - echo "Warning: Only Ubuntu and SUSE hosts are fully supported for now!" - echo "Warning: CentOS 7 support is still work in progress." - echo -fi - # Clone OPNFV scenario repositories #------------------------------------------------------------------------------- # This playbook @@ -143,9 +137,7 @@ echo "-------------------------------------------------------------------------" #------------------------------------------------------------------------------- # Get scenario variables overrides #------------------------------------------------------------------------------- -if [[ -f $XCI_SCENARIOS_CACHE/${DEPLOY_SCENARIO:-_no_scenario_}/xci_overrides ]]; then - source $XCI_SCENARIOS_CACHE/$DEPLOY_SCENARIO/xci_overrides -fi +source $(find $XCI_SCENARIOS_CACHE/${DEPLOY_SCENARIO} -name xci_overrides) &>/dev/null || : #------------------------------------------------------------------------------- # Start provisioning VM nodes |