From 252173e035ea5c3e3568f4f2b843e3ab10b57e18 Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Thu, 27 Nov 2014 18:01:12 +0000 Subject: FIXME and SQUEEZEME: Add log directory and create a volume group for cinder This commit adds a temporarly way to test cinder. It assumes that when the VM is deployed it will also add a second image to the VM where the Volumes for cinder will be placed when creating. --- .../usr/share/openstack/openstack-cinder-setup | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/openstack/usr/share/openstack/openstack-cinder-setup b/openstack/usr/share/openstack/openstack-cinder-setup index 281481cd..bd21a6cc 100644 --- a/openstack/usr/share/openstack/openstack-cinder-setup +++ b/openstack/usr/share/openstack/openstack-cinder-setup @@ -60,6 +60,12 @@ if [ ! -d /var/lock/cinder ]; then chown -R cinder:cinder /var/lock/cinder fi +# Create the log directory for cinder +if [ ! -d /var/log/cinder ]; then + mkdir -p /var/log/cinder + chown -R cinder:cinder /var/log/cinder +fi + # Setup the cinder database if [ ! -e /var/lib/cinder/cinder.sqlite ]; then chown -R cinder:cinder /var/lib/cinder @@ -72,6 +78,23 @@ if [ ! -d /var/lib/cinder/volumes ]; then chown -R cinder:cinder /var/lib/cinder/volumes fi +# This is only for testing purposes and we need to change it for +# something more robust to deploy in production. +# This also assumes that the user will add a second disk to its VM +# and if it does not find sdb or vda it will fail. +if [ $(ls /sys/block | grep -v sda | grep [vs]d | wc -l) -ne 1 ]; then + echo "Error: More than one or none block device found, cinder will not be able to create a VG." + exit 1 +else + device=/dev/$(ls /sys/block | grep -v sda | grep [vs]d) +fi + +# Create a physical volume +pvcreate -ff -y $device + +# Create a volume group named "cinder-volumes" +vgcreate -y cinder-volumes $device + # Remove the one-shot setup service rm /etc/systemd/system/multi-user.target.wants/openstack-cinder-setup.service -- cgit v1.2.1