From f50e331e1a3b377b0530fa3f99b542abef0a6005 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 9 May 2019 18:49:31 +0100 Subject: [PATCH] CI Test: Support being source of a Ceph upgrade Allow Stein release to be the source of a Ceph upgrade test. Change-Id: I289dc4b90356049eaa756a69f814696453556f7c --- tests/run.yml | 10 ++++++---- tests/templates/globals-default.j2 | 2 +- tests/test-openstack.sh | 14 +++++++++++++- tools/setup_gate.sh | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/run.yml b/tests/run.yml index bc9cbead17..b271b27fd4 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -2,13 +2,14 @@ - hosts: all vars: kolla_ansible_local_src_dir: "{{ zuul.executor.work_root }}/src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible" + is_ceph: "{{ 'ceph' in scenario }}" tasks: - name: Prepare disks for Ceph or LVM script: "setup_disks.sh {{ disk_type }}" - when: scenario in ["ceph", "cinder-lvm"] + when: scenario == "cinder-lvm" or is_ceph become: true vars: - disk_type: "{{ ceph_storetype if scenario == 'ceph' else 'cinder-lvm' }}" + disk_type: "{{ ceph_storetype if is_ceph else 'cinder-lvm' }}" ceph_storetype: "{{ hostvars[inventory_hostname].get('ceph_osd_storetype') }}" - hosts: primary @@ -19,6 +20,7 @@ kolla_ansible_local_src_dir: "{{ zuul.executor.work_root }}/src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible" need_build_image: false build_image_tag: "change_{{ zuul.change | default('none') }}" + is_ceph: "{{ 'ceph' in scenario }}" tasks: # FIXME: in multi node env, api_interface may be different on each node. - name: detect api_interface_name variable @@ -87,7 +89,7 @@ # ceph.conf - src: "tests/templates/ceph-overrides.j2" dest: /etc/kolla/config/ceph.conf - when: scenario == "ceph" + when: "{{ is_ceph }}" # bifrost/dib.yml - src: "tests/templates/bifrost-dib-overrides.j2" dest: /etc/kolla/config/bifrost/dib.yml @@ -223,7 +225,7 @@ # ceph.conf - src: "tests/templates/ceph-overrides.j2" dest: /etc/kolla/config/ceph.conf - when: "'ceph' in scenario" + when: "{{ is_ceph }}" when: item.when | default(true) - name: upgrade kolla-ansible requirements diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index 60908a780b..04c0e16e19 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -39,7 +39,7 @@ openstack_release: "{{ previous_release }}" {% endif %} {% endif %} -{% if scenario == "ceph" %} +{% if is_ceph %} enable_ceph: "yes" enable_cinder: "yes" ceph_pool_pg_num: 8 diff --git a/tests/test-openstack.sh b/tests/test-openstack.sh index 4f6d6d1248..d6673a60fb 100755 --- a/tests/test-openstack.sh +++ b/tests/test-openstack.sh @@ -24,7 +24,7 @@ function test_openstack_logged { fi echo "SUCCESS: Server creation" - if [[ $ACTION = "ceph" ]] || [[ $ACTION == "cinder-lvm" ]]; then + if [[ $ACTION =~ "ceph" ]] || [[ $ACTION == "cinder-lvm" ]]; then echo "TESTING: Cinder volume attachment" openstack volume create --size 2 test_volume attempt=1 @@ -51,6 +51,18 @@ function test_openstack_logged { sleep 10 done openstack server remove volume kolla_boot_test test_volume + attempt=1 + while [[ $(openstack volume show test_volume -f value -c status) != "available" ]]; do + echo "Volume not detached yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to detach" + openstack volume show test_volume + return 1 + fi + sleep 10 + done + openstack volume delete test_volume echo "SUCCESS: Cinder volume attachment" fi diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index 2b92842626..22b22d43b9 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -27,7 +27,7 @@ EOF GATE_IMAGES="bifrost" fi - if [[ $ACTION == "ceph" ]]; then + if [[ $ACTION =~ "ceph" ]]; then GATE_IMAGES+=",ceph,cinder" fi