debian: initramfs-ostree - Initial AIO partition/format support
Add temporary installer support for creating default filesystem configuration for AIOs. This will create the following based on the current AIO CentOS kickstart settings for large disks: - Platform backup partition/filesystem - Default physical volume and volume group for cgts-vg - Logical volumes for log-lv and scratch-lv - Format platform backup, log, and scratch filesystem as ext4 Test Plan (using 512G root disk): - PASS: Build/Install ISO - PASS: Observe correct partitions, physical volume, volume group, logical volumes present after boot - PASS: Reinstall ISO after successful install Note: /etc/fstab is updated as a post-rootfs script in base-bullseye.yaml Story: 2009101 Task: 44398 Signed-off-by: Robert Church <robert.church@windriver.com> Change-Id: I6fb3f5bcd26f9035327fb614a34b8fc35ea64362
This commit is contained in:
parent
8b536d2757
commit
364acf2f20
@ -0,0 +1,30 @@
|
||||
From d0aca679be610c4dbb8b3977be335f8d0dcd5e03 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Church <robert.church@windriver.com>
|
||||
Date: Tue, 1 Feb 2022 03:13:15 -0500
|
||||
Subject: [PATCH 3/3] Add lvm2 package to initramfs
|
||||
|
||||
LVM will be used to set up the minimal StarlingX volume group. Include
|
||||
the package in the Depends list so that vgcreate, pvcreate, lvcreate
|
||||
commands are available for provisioning.
|
||||
|
||||
Signed-off-by: Robert Church <robert.church@windriver.com>
|
||||
---
|
||||
debian/control | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index 002f25a..899bbb2 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -25,7 +25,7 @@ Homepage: https://github.com/WindRiver-Labs/meta-lat
|
||||
|
||||
Package: initramfs-ostree
|
||||
Architecture: all
|
||||
-Depends: gdisk, e2fsprogs, ${misc:Depends}, ${shlibs:Depends}
|
||||
+Depends: gdisk, e2fsprogs, lvm2, ${misc:Depends}, ${shlibs:Depends}
|
||||
Multi-Arch: foreign
|
||||
Description: Init for initramfs to mount ostree
|
||||
Basic init for initramfs to mount ostree and pivot root
|
||||
--
|
||||
2.16.6
|
||||
|
@ -1,2 +1,3 @@
|
||||
0001-Cleanup-package-depends-lists.patch
|
||||
0002-Update-Copyright-and-License.patch
|
||||
0003-Add-lvm2-package-to-initramfs.patch
|
||||
|
@ -0,0 +1,28 @@
|
||||
From: Robert Church <robert.church@windriver.com>
|
||||
Date: Sun, 30 Jan 2022 20:55:04 -0500
|
||||
Subject: Prevent auto-expansion of fluxdata partition
|
||||
|
||||
Set VSZ=20480 to prevent the fluxdata parition from expanding to fill
|
||||
all free space on the root disk.
|
||||
|
||||
For an AIO we want to provide free space for various customer driven
|
||||
provisioning scenarios.
|
||||
|
||||
Signed-off-by: Robert Church <robert.church@windriver.com>
|
||||
---
|
||||
init-ostree.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/init-ostree.sh b/init-ostree.sh
|
||||
index 1702e55..3b043ea 100644
|
||||
--- a/init-ostree.sh
|
||||
+++ b/init-ostree.sh
|
||||
@@ -32,7 +32,7 @@ ROOT_DELAY="0"
|
||||
OSTREE_SYSROOT=""
|
||||
OSTREE_BOOT_DEVICE="LABEL=otaboot"
|
||||
OSTREE_LABEL_FLUXDATA="fluxdata"
|
||||
-VSZ=0
|
||||
+VSZ=20480
|
||||
SKIP_BOOT_DIFF=""
|
||||
ALLOW_RM_VAR=1
|
||||
# The timeout (tenth of a second) for rootfs on low speed device
|
@ -0,0 +1,204 @@
|
||||
From: Robert Church <robert.church@windriver.com>
|
||||
Date: Mon, 31 Jan 2022 22:47:09 -0500
|
||||
Subject: debian: Add CentOS compatible initial AIO partitioning/formatting
|
||||
|
||||
Add support for initial AIO partitioning and LVM formatting for AIO
|
||||
hosts.
|
||||
- Creates platform-backup partition
|
||||
- Creates default cgts-vg volume group and physical volume
|
||||
- Creates initial logical volumes for scratch-lv and log-lv
|
||||
|
||||
Signed-off-by: Robert Church <robert.church@windriver.com>
|
||||
---
|
||||
init-ostree-install.sh | 122 +++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 119 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/init-ostree-install.sh b/init-ostree-install.sh
|
||||
index 55ece63..1d056a5 100644
|
||||
--- a/init-ostree-install.sh
|
||||
+++ b/init-ostree-install.sh
|
||||
@@ -82,7 +82,9 @@ OPTIONAL:
|
||||
BSZ=# - MB size of boot partition
|
||||
RSZ=# - MB size of root partition
|
||||
VSZ=# - MB size of var partition (0 for auto expand)
|
||||
-
|
||||
+ StarlingX
|
||||
+ inststx=0 - install StarlingX partitioning
|
||||
+ personality=aio - StarlingX install personality (aio,con,wor,sto)
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -102,7 +104,7 @@ conflict_label() {
|
||||
local op=$1
|
||||
local 'label' 'd' 'devs' 'conflict' 'i' 'fstype'
|
||||
conflict=1
|
||||
- for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata; do
|
||||
+ for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata platform_backup platform_pv; do
|
||||
devs=$(blkid -t LABEL=$label -o device |grep -v $INSTDEV)
|
||||
if [ "$devs" != "" ] ; then
|
||||
i=0
|
||||
@@ -513,6 +515,8 @@ IP=""
|
||||
MAX_TIMEOUT_FOR_WAITING_LOWSPEED_DEVICE=60
|
||||
OSTREE_KERNEL_ARGS=${OSTREE_KERNEL_ARGS=%OSTREE_KERNEL_ARGS%}
|
||||
KS=""
|
||||
+INSTSTX=${INSTSTX=""}
|
||||
+PERSONALITY=${PERSONALITY=""}
|
||||
|
||||
if [ "$OSTREE_KERNEL_ARGS" = "%OSTREE_KERNEL_ARGS%" ] ; then
|
||||
OSTREE_KERNEL_ARGS="ro rootwait"
|
||||
@@ -603,6 +607,10 @@ read_args() {
|
||||
RSZ=$optarg ;;
|
||||
VSZ=*)
|
||||
VSZ=$optarg ;;
|
||||
+ inststx=*)
|
||||
+ INSTSTX=$optarg ;;
|
||||
+ personality=*)
|
||||
+ PERSONALITY=$optarg ;;
|
||||
esac
|
||||
done
|
||||
# defaults if not set
|
||||
@@ -615,6 +623,9 @@ read_args() {
|
||||
if [ "$INSTGPG" = "" ] ; then INSTGPG=1 ; fi
|
||||
if [ "$INSTFLUX" = "" ] ; then INSTFLUX=1 ; fi
|
||||
if [ "$INSTSBD" = "" ] ; then INSTSBD=2 ; fi
|
||||
+ if [ "$INSTSTX" = "" ] ; then INSTSTX=0 ; fi
|
||||
+ if [ "$PERSONALITY" = "" ] ; then PERSONALITY=aio ; fi
|
||||
+
|
||||
}
|
||||
|
||||
shell_start() {
|
||||
@@ -680,6 +691,40 @@ grub_partition() {
|
||||
a=""
|
||||
first=`sgdisk -F ${dev}|grep -v Creating`
|
||||
else
|
||||
+ ############################################
|
||||
+ # StarlingX: Clean up the volume group
|
||||
+ if [ "$INSTSTX" = 1 ] ; then
|
||||
+ if [ "$VSZ" = 0 ] ; then
|
||||
+ # /var using up the remainder of the disk
|
||||
+ echo "WARNING WARNING - No volume group info to clean up, /var will use the remainder of the disk"
|
||||
+ else
|
||||
+ case $PERSONALITY in
|
||||
+ aio)
|
||||
+ echo "AIO: Clean up the volume group so that the disk can be re-partitioned"
|
||||
+ vgremove -f cgts-vg
|
||||
+
|
||||
+ # Find and wipe any existing PVs
|
||||
+ partitions=$(pvs -o pv_name --noheading | grep -v '\[unknown\]')
|
||||
+ for p in $partitions
|
||||
+ do
|
||||
+ echo "Pre-wiping $p (pvs present)"
|
||||
+ dd if=/dev/zero of=$p bs=512 count=34
|
||||
+ dd if=/dev/zero of=$p bs=512 count=34 seek=$((`blockdev --getsz $p` - 34))
|
||||
+ pvremove -f $p
|
||||
+ wipefs -a $p
|
||||
+ done
|
||||
+ ;;
|
||||
+ con)
|
||||
+ ;;
|
||||
+ wor)
|
||||
+ ;;
|
||||
+ sto)
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ fi
|
||||
+ ############################################
|
||||
+
|
||||
sgdisk -Z ${dev}
|
||||
first=`sgdisk -F ${dev}|grep -v Creating`
|
||||
if [ "$BIOSPLUSEFI" = "1" ] ; then
|
||||
@@ -730,6 +775,41 @@ grub_partition() {
|
||||
fi
|
||||
a="$a -n $p:$first:$end -c $p:fluxdata"
|
||||
fi
|
||||
+
|
||||
+ ############################################
|
||||
+ # StarlingX: Temp partitioning compatability
|
||||
+ if [ "$INSTSTX" = 1 ] ; then
|
||||
+ if [ "$VSZ" = 0 ] ; then
|
||||
+ # /var using up the remainder of the disk
|
||||
+ echo "WARNING WARNING - Can't allocate StarlingX partitions, /var will use the remainder of the disk"
|
||||
+ else
|
||||
+ grub_pt_update
|
||||
+ case $PERSONALITY in
|
||||
+ aio)
|
||||
+ echo "Allocating StarlingX AIO host partitioning"
|
||||
+ CGCS_PV_SIZE=183296
|
||||
+ PLATFORM_BACKUP_SIZE=30000
|
||||
+
|
||||
+ end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1))
|
||||
+ a="$a -n $p:$first:$end -c $p:platform_backup -t $p:FFFF"
|
||||
+ grub_pt_update
|
||||
+ end=$(($first+($CGCS_PV_SIZE*1024*1024/$lsz)-1))
|
||||
+ a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00"
|
||||
+ ;;
|
||||
+ con)
|
||||
+ echo "WARNING WARNING: StarlingX standard controller host partitioning not supported"
|
||||
+ ;;
|
||||
+ wor)
|
||||
+ echo "WARNING WARNING: StarlingX worker host partitioning not supported"
|
||||
+ ;;
|
||||
+ sto)
|
||||
+ echo "WARNING WARNING: StarlingX storage host partitioning not supported"
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ fi
|
||||
+ ############################################
|
||||
+
|
||||
sgdisk $a -p ${dev}
|
||||
}
|
||||
|
||||
@@ -1016,7 +1096,7 @@ fi
|
||||
udevadm settle --timeout=3
|
||||
|
||||
cnt=50
|
||||
-while [ $cnt ] ; do
|
||||
+while [ "$cnt" -gt 0 ] ; do
|
||||
blockdev --rereadpt ${dev} 2> /dev/null > /dev/null && break
|
||||
sleep 0.1
|
||||
cnt=$(($cnt - 1))
|
||||
@@ -1074,6 +1154,42 @@ if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then
|
||||
mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART}
|
||||
fi
|
||||
fi
|
||||
+ ########################################
|
||||
+ # StarlingX: Temp VG/PV/LV/FS formatting
|
||||
+ if [ "$INSTSTX" = 1 ] ; then
|
||||
+ if [ "$VSZ" = 0 ] ; then
|
||||
+ echo "WARNING WARNING - Skipping StarlingX default LVM storage, /var will use the remainder of the disk"
|
||||
+ else
|
||||
+ case $PERSONALITY in
|
||||
+ aio)
|
||||
+ echo "Creating StarlingX AIO host default LVM storage"
|
||||
+ LOG_VOL_SIZE=8000
|
||||
+ SCRATCH_VOL_SIZE=16000
|
||||
+
|
||||
+ pi=$((pi+2))
|
||||
+ mkfs.ext4 -F -L platform_backup ${fs_dev}${pi}
|
||||
+
|
||||
+ pi=$((pi+1))
|
||||
+ vgcreate --force cgts-vg ${fs_dev}${pi}
|
||||
+ lvcreate -n log-lv --size "${LOG_VOL_SIZE}MB" cgts-vg
|
||||
+ mkfs.ext4 -F /dev/cgts-vg/log-lv
|
||||
+ lvcreate -n scratch-lv --size "${SCRATCH_VOL_SIZE}MB" cgts-vg
|
||||
+ mkfs.ext4 -F /dev/cgts-vg/scratch-lv
|
||||
+
|
||||
+ ;;
|
||||
+ con)
|
||||
+ echo "WARNING WARNING: StarlingX standard controller host default LVM storage not supported"
|
||||
+ ;;
|
||||
+ wor)
|
||||
+ echo "WARNING WARNING: StarlingX worker host default LVM storage not supported"
|
||||
+ ;;
|
||||
+ sto)
|
||||
+ echo "WARNING WARNING: StarlingX storage host default LVM storage not supported"
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ fi
|
||||
+ ########################################
|
||||
elif [ "$INSTFMT" != 0 ] ; then
|
||||
if [ $INSTSF = 1 ] ; then
|
||||
dosfslabel ${fs_dev}${p1} boot
|
2
ostree/initramfs-ostree/debian/patches/series
Normal file
2
ostree/initramfs-ostree/debian/patches/series
Normal file
@ -0,0 +1,2 @@
|
||||
0001-Prevent-auto-expansion-of-fluxdata-partition.patch
|
||||
0002-debian-Add-CentOS-compatible-initial-AIO-partitionin.patch
|
Loading…
Reference in New Issue
Block a user