From 1e2599e4801c1acd16ea61a533d95bbd7a808a54 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Fri, 28 Feb 2014 09:11:14 -0500 Subject: cinder-volume: change lvm pv to be configured at runtime By default lvm-iscsi uses loopdev as lvm physical volume. This patch makes it a bit easier to allow other layer to be able configure lvm physical volume. Signed-off-by: Vu Tran Signed-off-by: Bruce Ashfield --- .../recipes-devtools/python/python-cinder/cinder-volume | 11 ++--------- .../python/python-cinder/lvm_iscsi_setup.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 meta-openstack/recipes-devtools/python/python-cinder/lvm_iscsi_setup.sh (limited to 'meta-openstack/recipes-devtools/python/python-cinder') diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume index 51bbac9..3cc2aa3 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume +++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume @@ -29,15 +29,8 @@ start() fi fi - #Load volume group - DEV=`losetup -j /etc/cinder/volumes-backing | cut -d ":" -f 1 | head -1` - if [ -z $DEV ]; then - DEV=`losetup -f --show /etc/cinder/volumes-backing` - fi - if ! vgs cinder-volumes &> /dev/null ; then - vgcreate cinder-volumes $DEV - fi - vgchange -ay cinder-volumes + #Load volume group + /bin/bash /etc/cinder/drivers/lvm_iscsi_setup.sh echo -n "Starting $DESC..." diff --git a/meta-openstack/recipes-devtools/python/python-cinder/lvm_iscsi_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/lvm_iscsi_setup.sh new file mode 100644 index 0000000..6cd7011 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-cinder/lvm_iscsi_setup.sh @@ -0,0 +1,13 @@ +#Load volume group + +[[ -f /etc/cinder/volumes-backing ]] || truncate -s %CINDER_LVM_VOLUME_BACKING_FILE_SIZE% /etc/cinder/volumes-backing + +DEV=`losetup -j /etc/cinder/volumes-backing | cut -d ":" -f 1 | head -1` +if [ -z $DEV ]; then + DEV=`losetup -f --show /etc/cinder/volumes-backing` +fi +if ! vgs cinder-volumes &> /dev/null ; then + vgcreate cinder-volumes $DEV +fi + +vgchange -ay cinder-volumes -- cgit v1.2.3-54-g00ecf