kolla-ansible/tests/setup_disks.sh
Mark Goddard c41c9a0ce0 Add cinder-lvm CI job
Tests Cinder with an LVM/iSCSI backend, including attaching a volume to
an instance.

Change-Id: I6963b5e81d7ac88dd1bdfb94b62d9d63028b9786
2019-03-01 14:36:30 +00:00

47 lines
1.7 KiB
Bash

mkdir -p /opt/data/kolla
if [ $1 = 'cinder-lvm' ]; 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 = '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
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-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