Commit c85b9344 authored by David Johnson's avatar David Johnson

Give Glance 32GB backing store by default; refactor LVM/extra space goo.

parent 33a92dc6
......@@ -927,6 +927,38 @@ if [ -z "${GLANCE_DBPASS}" ]; then
su -s /bin/sh -c "/usr/bin/glance-manage db_sync" glance
#
# Possibly create a larger image storage space.
#
if [ -n "$GLANCE_EXTRA_SPACE" -a ! $GLANCE_EXTRA_SPACE = 0 ]; then
service_stop glance-registry
service_stop glance-api
$DIRNAME/setup-extra-space.sh
. $LOCALSETTINGS
mkdir -p ${STORAGEDIR}/glance
chown glance:glance ${STORAGEDIR}/glance
chmod 770 ${STORAGEDIR}/glance
if [ $LVM = 1 ]; then
lvcreate -l ${GLANCE_EXTRA_SPACE}G -n glance $VGNAME
if [ -f /sbin/mkfs.ext4 ]; then
ftype=ext4
else
ftype=ext3
fi
mkfs.${ftype} /dev/$VGNAME/glance
echo "/dev/$VGNAME/glance ${STORAGEDIR}/glance none defaults 0 0" \
>> /etc/fstab
mount /dev/$VGNAME/nova ${STORAGEDIR}/glance
fi
rsync -avz /var/lib/glance/ ${STORAGEDIR}/glance/
rm -rf /var/lib/glance/*
mount -o bind ${STORAGEDIR}/glance /var/lib/glance
echo "${STORAGEDIR}/glance /var/lib/glance none defaults,bind 0 0" \
>> /etc/fstab
fi
service_restart glance-registry
service_enable glance-registry
service_restart glance-api
......
##
## Setup extra space. We prefer the LVM route, using all available PVs
## to create a big openstack-volumes VG. If that's not available, we
## fall back to mkextrafs.pl to create whatever it can in /storage.
##
set -x
EUID=`id -u`
# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "`dirname $0`/setup-lib.sh"
if [ -f $OURDIR/extra-space-done ]; then
exit 0
fi
logtstart "extra-space"
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
if [ -f $LOCALSETTINGS ]; then
. $LOCALSETTINGS
fi
STORAGEDIR=/storage
VGNAME="openstack-volumes"
ARCH=`uname -m`
maybe_install_packages lvm2
if [ $OSVERSION -ge $OSOCATA ]; then
maybe_install_packages thin-provisioning-tools
fi
#
# First try to make LVM volumes; fall back to mkextrafs.pl /storage. We
# use /storage later, so we make the dir either way.
#
mkdir -p ${STORAGEDIR}
echo "STORAGEDIR=${STORAGEDIR}" >> $LOCALSETTINGS
# Check to see if we already have an `emulab` VG. This would occur
# if the user requested a temp dataset. If this happens, we simple
# rename it to the VG name we expect.
vgdisplay emulab
if [ $? -eq 0 ]; then
vgrename emulab $VGNAME
sed -i -re "s/^(.*)(\/dev\/emulab)(.*)$/\1\/dev\/$VGNAME\3/" /etc/fstab
LVM=1
echo "VGNAME=${VGNAME}" >> $LOCALSETTINGS
echo "LVM=1" >> $LOCALSETTINGS
elif [ -z "$LVM" ] ; then
LVM=1
MKEXTRAFS_ARGS="-l -v ${VGNAME} -m util -z 1024"
# On Cloudlab ARM machines, there is no second disk nor extra disk space
# Well, now there's a new partition layout; try it.
if [ "$ARCH" = "aarch64" ]; then
maybe_install_packages gdisk
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
sgdisk -N 2 /dev/sda
partprobe /dev/sda
if [ $? -eq 0 ] ; then
partprobe /dev/sda
# Add the second partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s 2"
else
MKEXTRAFS_ARGS=""
VGNAME=
LVM=0
fi
else
MKEXTRAFS_ARGS=""
VGNAME=
LVM=0
fi
fi
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS}
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS} -f
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl -f ${STORAGEDIR}
LVM=0
fi
fi
echo "VGNAME=${VGNAME}" >> $LOCALSETTINGS
echo "LVM=${LVM}" >> $LOCALSETTINGS
fi
logtend "extra-space"
touch $OURDIR/extra-space-done
......@@ -99,6 +99,7 @@ SUPPORT_DYNAMIC_NODES=0
KEYSTONEAPIVERSION=""
TOKENTIMEOUT=14400
SESSIONTIMEOUT=14400
GLANCE_EXTRA_SPACE=32
CEILOMETER_USE_WSGI=0
QUOTASOFF=1
# Off by default; seems to cause intermittent keystone unavailability.
......
......@@ -23,6 +23,11 @@ if [ -f $OURDIR/setup-object-host-done ]; then
exit 0
fi
#
# Ensure extra space, *before* we source LOCALSETTINGS.
#
$DIRNAME/setup-extra-space.sh
logtstart "object-storage"
if [ -f $SETTINGS ]; then
......@@ -35,63 +40,17 @@ fi
maybe_install_packages xfsprogs rsync
#
# First try to make LVM volumes; fall back to loop device in /storage. We use
# /storage for swift later, so we make the dir either way.
# Handle the case where we have no LVM.
#
VGNAME="openstack-volumes"
mkdir -p /storage
if [ -z "$LVM" ] ; then
LVM=1
MKEXTRAFS_ARGS="-l -v ${VGNAME} -m util -z 1024"
# On Cloudlab ARM machines, there is no second disk nor extra disk space
# Well, now there's a new partition layout; try it.
if [ "$ARCH" = "aarch64" ]; then
maybe_install_packages gdisk
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
sgdisk -N 2 /dev/sda
if [ $? -eq 0 ] ; then
partprobe
# Add the second partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s 2"
else
MKEXTRAFS_ARGS=""
LVM=0
fi
else
MKEXTRAFS_ARGS=""
LVM=0
fi
fi
# Check to see if we already have an `emulab` VG. This would occur
# if the user requested a temp dataset. If this happens, we simple
# rename it to the VG name we expect.
vgdisplay emulab
if [ $? -eq 0 ]; then
vgrename emulab $VGNAME
sed -i -re "s/^(.*)(\/dev\/emulab)(.*)$/\1\/dev\/$VGNAME\3/" /etc/fstab
else
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS}
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS} -f
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl -f /storage
LVM=0
fi
fi
fi
fi
LDEVS=""
if [ $LVM -eq 0 ] ; then
dd if=/dev/zero of=/storage/swiftv1 bs=32768 count=131072
dd if=/dev/zero of=${STORAGEDIR}/swiftv1 bs=32768 count=131072
LDEV=`losetup -f`
losetup $LDEV /storage/swiftv1
losetup $LDEV ${STORAGEDIR}/swiftv1
LDEVS="${LDEV}"
dd if=/dev/zero of=/storage/swiftv1-2 bs=32768 count=131072
dd if=/dev/zero of=${STORAGEDIR}/swiftv1-2 bs=32768 count=131072
LDEV=`losetup -f`
losetup $LDEV /storage/swiftv1-2
losetup $LDEV ${STORAGEDIR}/swiftv1-2
LDEVS="${LDEVS} ${LDEV}"
else
lvcreate -n swiftv1 -L 4G $VGNAME
......@@ -102,15 +61,15 @@ else
LDEVS="${LDEVS} ${LDEV}"
fi
mkdir -p /storage/mnt/swift
mkdir -p ${STORAGEDIR}/mnt/swift
for ldev in $LDEVS ; do
base=`basename $ldev`
mkfs.xfs $ldev
cat <<EOF >> /etc/fstab
$ldev /storage/mnt/swift/$base xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
$ldev ${STORAGEDIR}/mnt/swift/$base xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
EOF
mkdir -p /storage/mnt/swift/$base
mount /storage/mnt/swift/$base
mkdir -p ${STORAGEDIR}/mnt/swift/$base
mount ${STORAGEDIR}/mnt/swift/$base
done
cat <<EOF >> /etc/rsyncd.conf
......@@ -122,19 +81,19 @@ address = $MGMTIP
[account]
max connections = 8
path = /storage/mnt/swift
path = ${STORAGEDIR}/mnt/swift
read only = false
lock file = /var/lock/account.lock
[container]
max connections = 8
path = /storage/mnt/swift
path = ${STORAGEDIR}/mnt/swift
read only = false
lock file = /var/lock/container.lock
[object]
max connections = 8
path = /storage/mnt/swift
path = ${STORAGEDIR}/mnt/swift
read only = false
lock file = /var/lock/object.lock
EOF
......@@ -197,7 +156,7 @@ crudini --set /etc/swift/account-server.conf DEFAULT bind_ip $MGMTIP
crudini --set /etc/swift/account-server.conf DEFAULT bind_port 6002
crudini --set /etc/swift/account-server.conf DEFAULT user swift
crudini --set /etc/swift/account-server.conf DEFAULT swift_dir /etc/swift
crudini --set /etc/swift/account-server.conf DEFAULT devices /storage/mnt/swift
crudini --set /etc/swift/account-server.conf DEFAULT devices ${STORAGEDIR}/mnt/swift
if [ $OSVERSION -ge $OSLIBERTY ]; then
crudini --set /etc/swift/account-server.conf DEFAULT mount_check true
fi
......@@ -231,7 +190,7 @@ crudini --set /etc/swift/container-server.conf DEFAULT bind_ip $MGMTIP
crudini --set /etc/swift/container-server.conf DEFAULT bind_port 6001
crudini --set /etc/swift/container-server.conf DEFAULT user swift
crudini --set /etc/swift/container-server.conf DEFAULT swift_dir /etc/swift
crudini --set /etc/swift/container-server.conf DEFAULT devices /storage/mnt/swift
crudini --set /etc/swift/container-server.conf DEFAULT devices ${STORAGEDIR}/mnt/swift
if [ $OSVERSION -ge $OSLIBERTY ]; then
crudini --set /etc/swift/container-server.conf DEFAULT mount_check true
fi
......@@ -268,7 +227,7 @@ crudini --set /etc/swift/object-server.conf DEFAULT bind_ip $MGMTIP
crudini --set /etc/swift/object-server.conf DEFAULT bind_port 6000
crudini --set /etc/swift/object-server.conf DEFAULT user swift
crudini --set /etc/swift/object-server.conf DEFAULT swift_dir /etc/swift
crudini --set /etc/swift/object-server.conf DEFAULT devices /storage/mnt/swift
crudini --set /etc/swift/object-server.conf DEFAULT devices ${STORAGEDIR}/mnt/swift
if [ $OSVERSION -ge $OSLIBERTY ]; then
crudini --set /etc/swift/object-server.conf DEFAULT mount_check true
fi
......@@ -305,7 +264,7 @@ crudini --set /etc/swift/object-server.conf object-auditor log_name swift-object
echo 'if $programname == "swift-object" then { action(type="omfile" file="/var/log/swift/swift-object.log") }' >> /etc/rsyslog.d/99-swift.conf
chown -R swift:swift /storage/mnt/swift
chown -R swift:swift ${STORAGEDIR}/mnt/swift
mkdir -p /var/cache/swift
chown -R swift:swift /var/cache/swift
......
......@@ -96,65 +96,21 @@ crudini --set /etc/manila/manila.conf oslo_concurrency \
maybe_install_packages lvm2 nfs-kernel-server
if [ "$MANILADRIVER" = "lvm" ]; then
#
# First try to make LVM volumes; fall back to loop device in /storage. We use
# /storage for swift later, so we make the dir either way.
#
mkdir -p /storage
if [ -z "$MNLVM" ] ; then
MNLVM=1
MNVGNAME="manila-volumes"
MKEXTRAFS_ARGS="-l -v ${MNVGNAME}" # -m util -z 1G"
# On Cloudlab ARM machines, there is no second disk nor extra disk space
# Well, now there's a new partition layout; try it.
if [ "$ARCH" = "aarch64" ]; then
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
sgdisk -N 2 /dev/sda
if [ $? -eq 0 ] ; then
partprobe
# Add the second partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s 2"
else
MKEXTRAFS_ARGS=""
MNLVM=0
fi
else
MKEXTRAFS_ARGS=""
MNLVM=0
fi
fi
# Check to see if we already have an `emulab` VG. This would occur
# if the user requested a temp dataset. If this happens, we simple
# rename it to the VG name we expect.
vgdisplay emulab
if [ $? -eq 0 ]; then
vgrename emulab $VGNAME
sed -i -re "s/^(.*)(\/dev\/emulab)(.*)$/\1\/dev\/$VGNAME\3/" /etc/fstab
fi
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS}
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS} -f
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl -f /storage
MNLVM=0
fi
fi
fi
$DIRNAME/setup-extra-space.sh
. $LOCALSETTINGS
MANILAVGNAME=${VGNAME}
if [ $MNLVM -eq 0 ] ; then
if [ $LVM -eq 0 ] ; then
MANILAVGNAME=manila-volumes
dd if=/dev/zero of=/storage/pvloop.2 bs=32768 count=131072
LDEV=`losetup -f`
losetup $LDEV /storage/pvloop.2
pvcreate $LDEV
vgcreate $MNVGNAME $LDEV
vgcreate $MANILAVGNAME $LDEV
fi
echo "MNLVM=$MNLVM" >> $LOCALSETTINGS
echo "MNVGNAME=${MNVGNAME}" >> $LOCALSETTINGS
echo "MANILAVGNAME=${MANILAVGNAME}" >> $LOCALSETTINGS
fi
if [ "$MANILADRIVER" = "lvm" ]; then
......@@ -167,7 +123,7 @@ if [ "$MANILADRIVER" = "lvm" ]; then
share_driver manila.share.drivers.lvm.LVMShareDriver
crudini --set /etc/manila/manila.conf lvm \
driver_handles_share_servers False
crudini --set /etc/manila/manila.conf lvm lvm_share_volume_group manila-volumes
crudini --set /etc/manila/manila.conf lvm lvm_share_volume_group ${MANILAVGNAME}
crudini --set /etc/manila/manila.conf lvm lvm_share_export_ip ${MGMTIP}
crudini --set /etc/manila/manila.conf lvm
else
......
......@@ -23,6 +23,11 @@ if [ -f $OURDIR/setup-storage-host-done ]; then
exit 0
fi
#
# Ensure extra space, *before* we source LOCALSETTINGS.
#
$DIRNAME/setup-extra-space.sh
logtstart "storage"
if [ -f $SETTINGS ]; then
......@@ -40,61 +45,17 @@ if [ $OSVERSION -ge $OSOCATA ]; then
fi
#
# First try to make LVM volumes; fall back to loop device in /storage. We use
# /storage for swift later, so we make the dir either way.
# Handle the case where we have no LVM.
#
mkdir -p /storage
VGNAME="openstack-volumes"
# Check to see if we already have an `emulab` VG. This would occur
# if the user requested a temp dataset. If this happens, we simple
# rename it to the VG name we expect.
vgdisplay emulab
if [ $? -eq 0 ]; then
vgrename emulab $VGNAME
sed -i -re "s/^(.*)(\/dev\/emulab)(.*)$/\1\/dev\/$VGNAME\3/" /etc/fstab
LVM=1
elif [ -z "$LVM" ] ; then
LVM=1
MKEXTRAFS_ARGS="-l -v ${VGNAME} -m util -z 1024"
# On Cloudlab ARM machines, there is no second disk nor extra disk space
# Well, now there's a new partition layout; try it.
if [ "$ARCH" = "aarch64" ]; then
maybe_install_packages gdisk
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
sgdisk -N 2 /dev/sda
partprobe /dev/sda
if [ $? -eq 0 ] ; then
partprobe /dev/sda
# Add the second partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s 2"
else
MKEXTRAFS_ARGS=""
LVM=0
fi
else
MKEXTRAFS_ARGS=""
LVM=0
fi
fi
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS}
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS} -f
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl -f /storage
LVM=0
fi
fi
fi
CINDERVGNAME=${VGNAME}
if [ $LVM -eq 0 ] ; then
CINDERVGNAME=cinder-volumes
dd if=/dev/zero of=/storage/pvloop.1 bs=32768 count=131072
LDEV=`losetup -f`
losetup $LDEV /storage/pvloop.1
pvcreate /dev/loop0
vgcreate $VGNAME /dev/loop0
pvcreate $LDEV
vgcreate $CINDERVGNAME $LDEV
fi
maybe_install_packages cinder-volume $DBDPACKAGE
......@@ -178,11 +139,11 @@ elif [ $OSVERSION -ge $OSLIBERTY ]; then
fi
if [ $OSVERSION -eq $OSJUNO ]; then
crudini --set /etc/cinder/cinder.conf DEFAULT volume_group openstack-volumes
crudini --set /etc/cinder/cinder.conf DEFAULT volume_group ${CINDERVGNAME}
else
crudini --set /etc/cinder/cinder.conf lvm \
volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
crudini --set /etc/cinder/cinder.conf lvm volume_group openstack-volumes
crudini --set /etc/cinder/cinder.conf lvm volume_group ${CINDERVGNAME}
crudini --set /etc/cinder/cinder.conf lvm iscsi_protocol iscsi
crudini --set /etc/cinder/cinder.conf lvm iscsi_helper tgtadm
crudini --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm
......@@ -194,8 +155,7 @@ service_restart cinder-volume
service_enable cinder-volume
rm -f /var/lib/cinder/cinder.sqlite
echo "LVM=$LVM" >> $LOCALSETTINGS
echo "VGNAME=${VGNAME}" >> $LOCALSETTINGS
echo "CINDERVGNAME=${CINDERVGNAME}" >> $LOCALSETTINGS
touch $OURDIR/setup-storage-host-done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment