kolla-ansible/tests/setup_disks.sh
Michal Nasiadka d8c15ad4e8 CI: Add Ceph-Ansible jobs
* Adding zuul centos-source/ubuntu-source ceph-ansible jobs
* Jobs will deploy all Ceph integrated OpenStack components, i.e.
  cinder, glance, nova
* Will utilize core openstack testing script

Depends-On: https://review.opendev.org/685032
Depends-On: https://review.opendev.org/698301

Implements: blueprint ceph-ansible
Change-Id: I233082b46785f74014177f579aeac887a25b2ae2
2020-01-24 22:37:03 +01:00

70 lines
2.5 KiB
Bash

#!/bin/bash
# $1: scenario / ceph store type
set -o xtrace
set -o errexit
mkdir -p /opt/data/kolla
if [ $1 = 'cinder-lvm' ] || [ $1 = 'zun' ]; then
# cinder-volumes volume group
free_device=$(losetup -f)
fallocate -l 5G /var/lib/cinder_data.img
losetup $free_device /var/lib/cinder_data.img
pvcreate $free_device
vgcreate cinder-volumes $free_device
elif [ $1 = 'swift' ]; then
# swift partition
free_device=$(losetup -f)
fallocate -l 5G /var/lib/swift_data.img
losetup $free_device /var/lib/swift_data.img
parted $free_device -s -- mklabel gpt mkpart KOLLA_SWIFT_DATA 1 -1
free_partition=${free_device}p1
mkfs.xfs -L d0 $free_partition
elif [ $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-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
elif [ $1 = 'bluestore' ]; then
# 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-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
elif [ $1 = 'ceph-lvm' ]; then
free_device=$(losetup -f)
fallocate -l 10G /var/lib/ceph-osd1.img
losetup $free_device /var/lib/ceph-osd1.img
pvcreate $free_device
vgcreate cephvg $free_device
lvcreate -l 100%FREE -n cephlv cephvg
else
echo "Unknown type" >&2
exit 1
fi
partprobe