7d4d3c78be
The persistent backup partition will be resized if it's detected to be smaller than it should be. Story: 2007403 Task: 39548 Change-Id: I6809a7c3a8363c8ee7f26bc9c8d61ed97451d29d Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com>
193 lines
6.7 KiB
INI
Executable File
193 lines
6.7 KiB
INI
Executable File
|
|
## NOTE: updates to partition sizes need to be also reflected in
|
|
## - stx-config/.../sysinv/conductor/manager.py:create_controller_filesystems()
|
|
## - stx-config/.../sysinv/common/constants.py
|
|
##
|
|
## NOTE: When adding partitions, we currently have a max of 4 primary partitions.
|
|
## If more than 4 partitions are required, we can use a max of 3 --asprimary,
|
|
## to allow 1 primary logical partition with extended partitions
|
|
##
|
|
## NOTE: Max default PV size must align with the default controllerfs sizes
|
|
##
|
|
## BACKUP_OVERHEAD = 10
|
|
##
|
|
## Physical install (for disks over 240GB)
|
|
## - DB size is doubled to allow for upgrades
|
|
##
|
|
## DEFAULT_IMAGE_STOR_SIZE = 10
|
|
## DEFAULT_DATABASE_STOR_SIZE = 20
|
|
## DEFAULT_IMG_CONVERSION_STOR_SIZE = 20
|
|
## BACKUP = DEFAULT_DATABASE_STOR_SIZE + DEFAULT_IMAGE_STOR_SIZE
|
|
## + BACKUP_OVERHEAD = 40
|
|
## LOG_VOL_SIZE = 8192
|
|
## SCRATCH_VOL_SIZE = 8192
|
|
## RABBIT = 2048
|
|
## PLATFORM = 2048
|
|
## ANCHOR = 1024
|
|
## EXTENSION = 1024
|
|
## GNOCCHI = 5120
|
|
## DOCKER = 30720
|
|
## DOCKER_DIST = 16384
|
|
## ETCD = 5120
|
|
## CEPH_MON = 20480
|
|
## KUBELET_VOL_SIZE = 10240
|
|
## RESERVED_PE = 16 (based on pesize=32768)
|
|
##
|
|
## CGCS_PV_SIZE = 10240 + 2*20480 + 20480 + 40960 + 8196 + 8196 + 2048 +
|
|
## 2048 + 1024 + 1024 + 5120 + 30720 + 16384 + 5120 +
|
|
## 20480 + 10240 + 16 = 223256
|
|
##
|
|
## small install - (for disks below 240GB)
|
|
## - DB size is doubled to allow for upgrades
|
|
##
|
|
## DEFAULT_SMALL_IMAGE_STOR_SIZE = 10
|
|
## DEFAULT_SMALL_DATABASE_STOR_SIZE = 10
|
|
## DEFAULT_SMALL_IMG_CONVERSION_STOR_SIZE = 10
|
|
## DEFAULT_SMALL_BACKUP_STOR_SIZE = 30
|
|
##
|
|
## LOG_VOL_SIZE = 8192
|
|
## SCRATCH_VOL_SIZE = 8192
|
|
## RABBIT = 2048
|
|
## PLATFORM = 2048
|
|
## ANCHOR = 1024
|
|
## EXTENSION = 1024
|
|
## GNOCCHI = 5120
|
|
## DOCKER = 30720
|
|
## DOCKER_DIST = 16384
|
|
## ETCD = 5120
|
|
## CEPH_MON = 20480
|
|
## KUBELET_VOL_SIZE = 10240
|
|
## RESERVED_PE = 16 (based on pesize=32768)
|
|
##
|
|
##
|
|
## CGCS_PV_SIZE = 10240 + 2*10240 + 10240 + 30720 + 8192 + 8192 + 2048 +
|
|
## 2048 + 1024 + 1024 + 5120 + 30720 + 16384 + 5120 +
|
|
## 20480 + 10240 + 16 = 182288
|
|
##
|
|
## NOTE: To maintain upgrade compatability within the volume group, keep the
|
|
## undersized LOG_VOL_SIZE and SCRATCH_VOL_SIZE, but size the minimally size
|
|
## physical volume correctly.
|
|
##
|
|
## R4 AIO installations:
|
|
## - R4 (case #1): /boot (0.5G), / (20G),
|
|
## cgts-vg PV (239G), /local_pv (239G)
|
|
## - R4 (case #2): /boot (0.5G), / (20G),
|
|
## cgts-vg PV (239G), cgts-vg (239G)
|
|
##
|
|
## Upgrade migration will start with R5 install and create a partition to align
|
|
## above so filesystems within the volume group will be able to maintain their
|
|
## sizes in R5
|
|
## - R5 install : /boot (0.5G), / (20G),
|
|
## cgts-vg PV (142G), un-partitioned (336G)
|
|
## - R5 (case #1): /boot (0.5G), / (20G),
|
|
## cgts-vg PV (142G), cgts-vg PV (97G), unpartitioned (239G)
|
|
## - R5 (case #2): /boot (0.5G), / (20G),
|
|
## cgts-vg PV (142G), cgts-vg PV (336G)
|
|
##
|
|
|
|
sz=$(blockdev --getsize64 $(get_disk $ROOTFS_DISK))
|
|
if [ $sz -le $((240*$gb)) ] ; then
|
|
# Round CGCS_PV_SIZE to the closest upper value that can be divided by 1024.
|
|
# 182288/1024=178.01. CGCS_PV_SIZE=179*1024=183296. Using a disk with a
|
|
# size under 179GiB will fail.
|
|
CGCS_PV_SIZE=183296
|
|
|
|
else
|
|
# Round CGCS_PV_SIZE to the closest upper value that can be divided by 1024.
|
|
# 223256/1024=218.02. CGCS_PV_SIZE=219*1024=224256.
|
|
CGCS_PV_SIZE=224256
|
|
fi
|
|
|
|
ROOTFS_SIZE=20000
|
|
LOG_VOL_SIZE=8000
|
|
SCRATCH_VOL_SIZE=8000
|
|
PLATFORM_BACKUP_SIZE=10000
|
|
BOOT_SIZE=500
|
|
EFI_SIZE=300
|
|
|
|
ROOTFS_OPTIONS="defaults"
|
|
profile_mode=`cat /proc/cmdline |xargs -n1 echo |grep security_profile= | grep extended`
|
|
if [ -n "$profile_mode" ]; then
|
|
# Enable iversion labelling for rootfs when IMA is enabled
|
|
ROOTFS_OPTIONS="${ROOTFS_OPTIONS},iversion"
|
|
fi
|
|
|
|
if [ -d /sys/firmware/efi ] ; then
|
|
BACKUP_PART=${ROOTFS_PART_PREFIX}1
|
|
BACKUP_PART_NO=1
|
|
START_POINT=1
|
|
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
|
BACKUP_END_POINT=$END_POINT
|
|
if [ $BACKUP_CREATED -eq 0 ] ; then
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
fi
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $EFI_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary fat32 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /boot/efi --fstype=efi --onpart=${ROOTFS_PART_PREFIX}2
|
|
EOF
|
|
else
|
|
BACKUP_PART=${ROOTFS_PART_PREFIX}2
|
|
BACKUP_PART_NO=2
|
|
parted -s $ROOTFS_DISK mkpart primary 1MiB 2MiB
|
|
|
|
START_POINT=2
|
|
END_POINT=$(($START_POINT + $PLATFORM_BACKUP_SIZE))
|
|
BACKUP_END_POINT=$END_POINT
|
|
if [ $BACKUP_CREATED -eq 0 ] ; then
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
fi
|
|
cat<<EOF>>/tmp/part-include
|
|
part biosboot --asprimary --fstype=biosboot --onpart=${ROOTFS_PART_PREFIX}1
|
|
EOF
|
|
fi
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $BOOT_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $ROOTFS_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart primary ext4 ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
START_POINT=$END_POINT
|
|
END_POINT=$(($START_POINT + $CGCS_PV_SIZE))
|
|
parted -s $ROOTFS_DISK mkpart extended ${START_POINT}MiB ${END_POINT}MiB
|
|
|
|
if [ $BACKUP_CREATED -ne 0 ] ; then
|
|
BACKUP_CURRENT_SIZE=$(parted -s $BACKUP_PART unit MiB print | grep $BACKUP_PART | awk '{print $3}' | sed 's/[^C0-9]*//g')
|
|
if [ $BACKUP_CURRENT_SIZE -lt $PLATFORM_BACKUP_SIZE ] ; then
|
|
# parted will throw an error about overlapping with the next partition if we don't do this
|
|
BACKUP_END_POINT=$(($BACKUP_END_POINT - 1)).9
|
|
parted -s $ROOTFS_DISK resizepart $BACKUP_PART_NO ${BACKUP_END_POINT}MiB
|
|
e2fsck -p -f $BACKUP_PART
|
|
resize2fs $BACKUP_PART
|
|
fi
|
|
cat<<EOF>>/tmp/part-include
|
|
part /opt/platform-backup --fstype=ext4 --asprimary --noformat --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
else
|
|
cat<<EOF>/tmp/backup-guid-change.sh
|
|
flock $ROOTFS_DISK sgdisk --change-name=${BACKUP_PART_NO}:"${BACKUP_PART_LABEL}" --typecode=${BACKUP_PART_NO}:"${BACKUP_PART_GUID}" $ROOTFS_DISK
|
|
EOF
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /opt/platform-backup --fstype=ext4 --asprimary --onpart=$BACKUP_PART --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
fi
|
|
|
|
cat<<EOF>>/tmp/part-include
|
|
part /boot --fstype=ext4 --asprimary --onpart=${ROOTFS_PART_PREFIX}3 --fsoptions="$ROOTFS_OPTIONS"
|
|
part pv.253004 --onpart=${ROOTFS_PART_PREFIX}5
|
|
volgroup cgts-vg --pesize=32768 pv.253004
|
|
logvol /var/log --fstype=ext4 --vgname=cgts-vg --size=$LOG_VOL_SIZE --name=log-lv
|
|
logvol /scratch --fstype=ext4 --vgname=cgts-vg --size=$SCRATCH_VOL_SIZE --name=scratch-lv
|
|
part / --fstype=ext4 --asprimary --onpart=${ROOTFS_PART_PREFIX}4 --fsoptions="$ROOTFS_OPTIONS"
|
|
EOF
|
|
|
|
%end
|
|
|