Commit 7a1db762 authored by David Johnson's avatar David Johnson

Merge branch 'tempdataset-mkextrafs-lvm'

parents 686b7e5d 32e802a0
......@@ -59,7 +59,39 @@ elif [ -e /dev/nvme0n1 ]; then
ROOTDEV=nvme0n1
ROOTPART=p4
fi
if [ -e $ROOTDISK -a "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
#
# Try to use LVM for this if possible; otherwise try to fall back to
# partition 4.
# 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.
#
mkdir -p /storage
vgdisplay emulab
if [ $? -eq 0 -a "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
LVM=1
VGNAME="openstack-volumes"
vgrename emulab $VGNAME
sed -i -re "s/^(.*)(\/dev\/emulab)(.*)$/\1\/dev\/$VGNAME\3/" /etc/fstab
lvcreate -l 75%FREE -n nova $VGNAME
if [ -f /sbin/mkfs.ext4 ]; then
mkfs.ext4 /dev/$VGNAME/nova
else
mkfs.ext3 /dev/$VGNAME/nova
fi
mkdir -p /mnt/var-lib-nova
echo "/dev/$VGNAME/nova /mnt/var-lib-nova none defaults,bind 0 0" \
>> /etc/fstab
mount /dev/$VGNAME/nova /mnt/var-lib-nova
chown nova:nova /mnt/var-lib-nova
rsync -avz /var/lib/nova/ /mnt/var-lib-nova/
mount -o bind /mnt/var-lib-nova /var/lib/nova
echo "/mnt/var-lib-nova /var/lib/nova none defaults,bind 0 0" \
>> /etc/fstab
elif [ -e $ROOTDISK -a "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
PART="${ROOTDISK}${ROOTPART}"
mkdir -p /mnt/var-lib-nova
FORCEARG=""
......
......@@ -38,11 +38,10 @@ 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.
#
VGNAME="openstack-volumes"
mkdir -p /storage
if [ -z "$LVM" ] ; then
LVM=1
VGNAME="openstack-volumes"
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.
......@@ -65,12 +64,21 @@ if [ -z "$LVM" ] ; then
fi
fi
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS}
if [ $? -ne 0 ]; then
/usr/local/etc/emulab/mkextrafs.pl ${MKEXTRAFS_ARGS} -f
# 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 -f /storage
LVM=0
/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
......
......@@ -124,6 +124,15 @@ if [ "$MANILADRIVER" = "lvm" ]; then
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
......
......@@ -43,11 +43,18 @@ 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.
#
mkdir -p /storage
if [ -z "$LVM" ] ; then
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
VGNAME="openstack-volumes"
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.
......
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