From 339b27c7fe2e95e8ae089adf66726b6adf42d9d5 Mon Sep 17 00:00:00 2001 From: "Michal (inc0) Jastrzebski" Date: Mon, 22 May 2017 10:03:36 -0700 Subject: [PATCH] Enable multi-scenario gates First non-trivial scenario we'll be testing in gates will be cinder + ceph. This patchset is supposed to create framework to easily add new testing scenarios. Change-Id: I6790eaf5cf3297af04a64e4169a39b6e2cd1890f --- tests/ansible_setup_ceph_disks.yml | 6 ++++++ tests/setup_ceph_disks.sh | 13 +++++++++++++ tests/templates/globals-default.j2 | 5 +++++ tools/setup_gate.sh | 11 ++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/ansible_setup_ceph_disks.yml create mode 100644 tests/setup_ceph_disks.sh diff --git a/tests/ansible_setup_ceph_disks.yml b/tests/ansible_setup_ceph_disks.yml new file mode 100644 index 0000000000..6bde46d558 --- /dev/null +++ b/tests/ansible_setup_ceph_disks.yml @@ -0,0 +1,6 @@ +--- +- hosts: storage + tasks: + - name: "Setup loopbacks for ceph" + script: setup_ceph_disks.sh + register: ceph_disks_out diff --git a/tests/setup_ceph_disks.sh b/tests/setup_ceph_disks.sh new file mode 100644 index 0000000000..2efb2042bc --- /dev/null +++ b/tests/setup_ceph_disks.sh @@ -0,0 +1,13 @@ +mkdir -p /opt/data/kolla +dd if=/dev/zero of=/opt/data/kolla/ceph-osd0.img bs=5M count=3072 +LOOP=$(losetup -f) +losetup $LOOP /opt/data/kolla/ceph-osd0.img +parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_OSD1 0 14GB + +dd if=/dev/zero of=/opt/data/kolla/ceph-journal0.img bs=5M count=1024 +LOOP=$(losetup -f) +losetup $LOOP /opt/data/kolla/ceph-journal0.img +parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_OSD1_J 0 5GB + +partprobe $LOOP + diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index 3cc20580cc..89f0432d8c 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -19,3 +19,8 @@ enable_horizon: "yes" enable_heat: "no" openstack_logging_debug: "True" openstack_service_workers: "1" + +{% if 'ceph' in action %} +enable_ceph: "yes" +enable_cinder: "yes" +{% endif %} diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index e6c905cc15..cf834bacbd 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -182,9 +182,14 @@ function sanity_check { neutron --debug agent-list tools/init-runonce nova --debug boot --poll --image $(openstack image list | awk '/cirros/ {print $2}') --nic net-id=$(openstack network list | awk '/demo-net/ {print $2}') --flavor 1 kolla_boot_test + nova --debug list # If the status is not ACTIVE, print info and exit 1 nova --debug show kolla_boot_test | awk '{buf=buf"\n"$0} $2=="status" && $4!="ACTIVE" {failed="yes"}; END {if (failed=="yes") {print buf; exit 1}}' + if echo $ACTION | grep -q "ceph"; then + openstack volume create --size 2 test_volume + openstack server add volume kolla_boot_test test_volume --device /dev/vdb + fi } function get_logs { @@ -200,11 +205,15 @@ setup_ansible setup_config setup_node -ansible-playbook -e type=$INSTALL_TYPE -e base=$BASE_DISTRO tests/ansible_generate_config.yml > /tmp/logs/ansible/generate_config +ansible-playbook -e type=$INSTALL_TYPE -e base=$BASE_DISTRO -e action=$ACTION tests/ansible_generate_config.yml > /tmp/logs/ansible/generate_config tools/kolla-ansible -i ${RAW_INVENTORY} bootstrap-servers > /tmp/logs/ansible/bootstrap-servers sudo tools/generate_passwords.py prepare_images +if echo $ACTION | grep -q "ceph"; then + ansible-playbook -i ${RAW_INVENTORY} tests/ansible_setup_ceph_disks.yml > /tmp/logs/ansible/setup_ceph_disks +fi + trap get_logs EXIT # Create dummy interface for neutron