Commit 424a1556 authored by David Johnson's avatar David Johnson

Skip small devices for pvcreate; attempt 4th part create first on some types.

parent ff0d5028
......@@ -95,7 +95,7 @@ elif [ "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
#
# See if we can try to use an LVM instead of just the 4th partition.
#
lsblk -n -P -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME | perl -e 'my %devs = (); while (<STDIN>) { $_ =~ s/([A-Z0-9a-z]+=)/;\$$1/g; eval "$_"; if (!($TYPE eq "disk" || $TYPE eq "part")) { next; }; if (exists($devs{$PKNAME})) { delete $devs{$PKNAME}; } if ($FSTYPE eq "" && $MOUNTPOINT eq "" && ($PARTTYPE eq "" || $PARTTYPE eq "0x0")) { $devs{$NAME} = "/dev/$NAME"; } }; print join(" ",values(%devs))."\n"' > /tmp/devs
lsblk -n -P -b -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME,SIZE | perl -e 'my %devs = (); while (<STDIN>) { $_ =~ s/([A-Z0-9a-z]+=)/;\$$1/g; eval "$_"; if (!($TYPE eq "disk" || $TYPE eq "part")) { next; }; if (exists($devs{$PKNAME})) { delete $devs{$PKNAME}; } if ($FSTYPE eq "" && $MOUNTPOINT eq "" && ($PARTTYPE eq "" || $PARTTYPE eq "0x0") && (int($SIZE) > 3221225472)) { $devs{$NAME} = "/dev/$NAME"; } }; print join(" ",values(%devs))."\n"' > /tmp/devs
DEVS=`cat /tmp/devs`
if [ -n "$DEVS" ]; then
VGNAME="openstack-volumes"
......
......@@ -59,10 +59,36 @@ elif [ -z "$LVM" ] ; then
LVM=1
DONE=0
#
# Handle unexpected partition layouts (e.g. no 4th partition on boot
# disk), and setup mkextrafs args, even if we're not going to use
# it.
#
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" -o "$ARCH" = "ppc64le" ]; then
maybe_install_packages gdisk
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
nparts=`sgdisk -p /dev/sda | grep -E '^ +[0-9]+ +.*$' | wc -l`
if [ $nparts -lt 4 ]; then
newpart=`expr $nparts + 1`
sgdisk -N $newpart /dev/sda
partprobe /dev/sda
if [ $? -eq 0 ] ; then
partprobe /dev/sda
# Add the new partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s $newpart"
fi
fi
fi
fi
#
# See if we can try to use an LVM instead of just the 4th partition.
#
lsblk -n -P -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME | perl -e 'my %devs = (); while (<STDIN>) { $_ =~ s/([A-Z0-9a-z]+=)/;\$$1/g; eval "$_"; if (!($TYPE eq "disk" || $TYPE eq "part")) { next; }; if (exists($devs{$PKNAME})) { delete $devs{$PKNAME}; } if ($FSTYPE eq "" && $MOUNTPOINT eq "" && ($PARTTYPE eq "" || $PARTTYPE eq "0x0")) { $devs{$NAME} = "/dev/$NAME"; } }; print join(" ",values(%devs))."\n"' > /tmp/devs
lsblk -n -P -b -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME,SIZE | perl -e 'my %devs = (); while (<STDIN>) { $_ =~ s/([A-Z0-9a-z]+=)/;\$$1/g; eval "$_"; if (!($TYPE eq "disk" || $TYPE eq "part")) { next; }; if (exists($devs{$PKNAME})) { delete $devs{$PKNAME}; } if ($FSTYPE eq "" && $MOUNTPOINT eq "" && ($PARTTYPE eq "" || $PARTTYPE eq "0x0") && (int($SIZE) > 3221225472)) { $devs{$NAME} = "/dev/$NAME"; } }; print join(" ",values(%devs))."\n"' > /tmp/devs
DEVS=`cat /tmp/devs`
if [ -n "$DEVS" ]; then
pvcreate $DEVS && vgcreate $VGNAME $DEVS
......@@ -77,35 +103,6 @@ elif [ -z "$LVM" ] ; then
fi
if [ $DONE -eq 0 ]; then
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" -o "$ARCH" = "ppc64le" ]; then
maybe_install_packages gdisk
sgdisk -i 1 /dev/sda
if [ $? -eq 0 ] ; then
nparts=`sgdisk -p /dev/sda | grep -E '^ +[0-9]+ +.*$' | wc -l`
if [ $nparts -lt 4 ]; then
newpart=`expr $nparts + 1`
sgdisk -N $newpart /dev/sda
partprobe /dev/sda
if [ $? -eq 0 ] ; then
partprobe /dev/sda
# Add the new partition specifically
MKEXTRAFS_ARGS="${MKEXTRAFS_ARGS} -s $newpart"
else
MKEXTRAFS_ARGS=""
VGNAME=
LVM=0
fi
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
......
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