From 6786bc5b7766b9eaf9736c6ee3f832ef6b84cfd6 Mon Sep 17 00:00:00 2001 From: "tone.zhang" Date: Fri, 23 Nov 2018 15:44:40 +0800 Subject: [PATCH] Add Kolla Ceph filestore CI jobs Since Rocky bluestore is the default store type used by Kolla Ceph. Filestore is still used by the customers. The patch allows deploy both Ceph bluestore OSD and Ceph filestore OSD in Kolla-ansible CI jobs. Change-Id: Iaa7c1b2ff35eb649c3a6d9f7266463d8961cdc9e Signed-off-by: tone.zhang --- tests/run.yml | 4 +-- tests/setup_ceph_disks.sh | 47 ++++++++++++++++++++++++------------ tests/templates/inventory.j2 | 2 +- zuul.d/jobs.yaml | 21 ++++++++++++++++ 4 files changed, 55 insertions(+), 19 deletions(-) diff --git a/tests/run.yml b/tests/run.yml index 04554b16eb..554c8e2329 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -4,8 +4,8 @@ kolla_ansible_src_dir: "src/{{ zuul.project.canonical_hostname }}/openstack/kolla-ansible" kolla_ansible_full_src_dir: "{{ zuul.executor.work_root }}/{{ kolla_ansible_src_dir }}" tasks: - - name: Prepare ceph disks - script: "{{ kolla_ansible_full_src_dir }}/tests/setup_ceph_disks.sh" + - name: Prepare ceph disks for bluestore and filestore OSD + script: "{{ kolla_ansible_full_src_dir }}/tests/setup_ceph_disks.sh {{ hostvars[inventory_hostname]['ceph_osd_storetype'] }}" when: scenario == "ceph" become: true diff --git a/tests/setup_ceph_disks.sh b/tests/setup_ceph_disks.sh index 214e5e3532..8426991194 100644 --- a/tests/setup_ceph_disks.sh +++ b/tests/setup_ceph_disks.sh @@ -1,23 +1,38 @@ mkdir -p /opt/data/kolla -dd if=/dev/zero of=/opt/data/kolla/ceph-osd0.img bs=5M count=128 -LOOP=$(losetup -f) -losetup $LOOP /opt/data/kolla/ceph-osd0.img -parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD1 1 -1 -dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-b.img bs=5M count=2048 -LOOP=$(losetup -f) -losetup $LOOP /opt/data/kolla/ceph-osd0-b.img -parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD1_B 1 -1 +if [ $1 = 'filestore' ]; then + #setup devices for Kolla Ceph filestore OSD + dd if=/dev/zero of=/opt/data/kolla/ceph-osd1.img bs=5M count=1000 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-osd1.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_OSD1 1 -1 -dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-w.img bs=5M count=256 -LOOP=$(losetup -f) -losetup $LOOP /opt/data/kolla/ceph-osd0-w.img -parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD1_W 1 -1 + dd if=/dev/zero of=/opt/data/kolla/ceph-journal1.img bs=5M count=512 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-journal1.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_OSD1_J 1 -1 +else + # Setup devices for Kolla Ceph bluestore OSD + dd if=/dev/zero of=/opt/data/kolla/ceph-osd0.img bs=5M count=100 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-osd0.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD0 1 -1 -dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-d.img bs=5M count=256 -LOOP=$(losetup -f) -losetup $LOOP /opt/data/kolla/ceph-osd0-d.img -parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD1_D 1 -1 + dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-b.img bs=5M count=1000 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-osd0-b.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD0_B 1 -1 + + dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-w.img bs=5M count=200 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-osd0-w.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD0_W 1 -1 + + dd if=/dev/zero of=/opt/data/kolla/ceph-osd0-d.img bs=5M count=200 + LOOP=$(losetup -f) + losetup $LOOP /opt/data/kolla/ceph-osd0-d.img + parted $LOOP -s -- mklabel gpt mkpart KOLLA_CEPH_OSD_BOOTSTRAP_BS_OSD0_D 1 -1 +fi partprobe diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index d3e00d0c0d..e1ab5c19a0 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -17,7 +17,7 @@ [storage] {% for host in hostvars %} -{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }} +{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }} ceph_osd_store_type={{ 'filestore' if host == 'primary' else 'bluestore' }} {% endfor %} [monitoring] diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 9b7956059d..2c2412734e 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -60,6 +60,13 @@ base_distro: ubuntu install_type: source scenario: ceph + host-vars: + primary: + ceph_osd_storetype: filestore + secondary1: + ceph_osd_storetype: bluestore + secondary2: + ceph_osd_storetype: bluestore - job: name: kolla-ansible-centos-source-ceph @@ -70,6 +77,13 @@ base_distro: centos install_type: source scenario: ceph + host-vars: + primary: + ceph_osd_storetype: filestore + secondary1: + ceph_osd_storetype: bluestore + secondary2: + ceph_osd_storetype: bluestore - job: name: kolla-ansible-oraclelinux-source-ceph @@ -80,6 +94,13 @@ base_distro: oraclelinux install_type: source scenario: ceph + host-vars: + primary: + ceph_osd_storetype: filestore + secondary1: + ceph_osd_storetype: bluestore + secondary2: + ceph_osd_storetype: bluestore - job: name: kolla-ansible-bifrost-centos-source