From 6d549c1fdd2910e8642dfc45c3875be5a16c4b1a Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 4 Apr 2019 17:13:59 +0800 Subject: [PATCH 1/5] Get disk size of install disk --- .../share/xcat/install/scripts/pre.rhels8 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index 66abd34db..11a9ee9d7 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -206,6 +206,26 @@ base64decode() done } +getdisksize() +{ + local disk="$1" + + local blah + local blocks + local name + + while read -r blah blah blocks name + do + if [ "${name}" = "${disk}" ] + then + echo "${blocks}" + break + fi + done >/tmp/partitionfile fi +DISKSIZE="$(getdisksize "${instdisk}")" + # TODO: Ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. At least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen... echo "part /boot --fstype=$BOOTFSTYPE --asprimary --ondisk=$instdisk --size=512" >>/tmp/partitionfile echo "part pv.000997 --grow --asprimary --ondisk=$instdisk --size=18432" >>/tmp/partitionfile From 2e726e81a94d4715c296c406486c2011e6f4c04c Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 8 Apr 2019 13:48:49 +0800 Subject: [PATCH 2/5] A new partition scheme for RHEL 8 compute node --- .../share/xcat/install/scripts/pre.rhels8 | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index 11a9ee9d7..115a2e6b0 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -206,10 +206,14 @@ base64decode() done } +# $1 - The device name, eg., sda +# Returns the device size, unit is KB. getdisksize() { local disk="$1" + [ -z "${disk}" ] && return + local blah local blocks local name @@ -265,15 +269,21 @@ fi DISKSIZE="$(getdisksize "${instdisk}")" # TODO: Ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. At least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen... -echo "part /boot --fstype=$BOOTFSTYPE --asprimary --ondisk=$instdisk --size=512" >>/tmp/partitionfile +echo "part /boot --fstype=$BOOTFSTYPE --asprimary --ondisk=$instdisk --size=1024" >>/tmp/partitionfile echo "part pv.000997 --grow --asprimary --ondisk=$instdisk --size=18432" >>/tmp/partitionfile echo "volgroup xcatvg --pesize=4096 pv.000997" >>/tmp/partitionfile -echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --size=4096 --maxsize=20480" >>/tmp/partitionfile -echo "logvol /var --fstype=$FSTYPE --name=var --vgname=xcatvg --grow --size=2048 --maxsize=8192" >>/tmp/partitionfile -echo "logvol /tmp --fstype=$FSTYPE --name=tmp --vgname=xcatvg --grow --size=1024 --maxsize=4096" >>/tmp/partitionfile -echo "logvol /home --fstype=$FSTYPE --name=home --vgname=xcatvg --grow --percent=10 --maxsize=10240" >>/tmp/partitionfile echo "logvol swap --name=swap --vgname=xcatvg --recommended" >>/tmp/partitionfile +if [ "${DISKSIZE} -lt "62914560" ] +then + echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --size=10240 --percent=85" >>/tmp/partitionfile +else + echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --size=10240 --maxsize=20480" >>/tmp/partitionfile + echo "logvol /var --fstype=$FSTYPE --name=var --vgname=xcatvg --grow --size=4096 --maxsize=8192" >>/tmp/partitionfile + echo "logvol /tmp --fstype=$FSTYPE --name=tmp --vgname=xcatvg --grow --size=4096 --maxsize=8192" >>/tmp/partitionfile + echo "logvol /home --fstype=$FSTYPE --name=home --vgname=xcatvg --grow --percent=10 --size=1024 --maxsize=10240" >>/tmp/partitionfile +fi + # Specify "bootloader" configuration in "/tmp/partitionfile" if there is no user customized partition file BOOTLOADER="bootloader" From a62468da3448e6a9bf4967d1a1375001b5209d90 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 9 Apr 2019 11:15:32 +0800 Subject: [PATCH 3/5] Patch pre.rhels8 --- xCAT-server/share/xcat/install/scripts/pre.rhels8 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index 115a2e6b0..4cb204623 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -212,6 +212,8 @@ getdisksize() { local disk="$1" + disk="${disk#/dev/}" + [ -z "${disk}" ] && return local blah @@ -274,14 +276,14 @@ echo "part pv.000997 --grow --asprimary --ondisk=$instdisk --size=18432" >>/tmp/ echo "volgroup xcatvg --pesize=4096 pv.000997" >>/tmp/partitionfile echo "logvol swap --name=swap --vgname=xcatvg --recommended" >>/tmp/partitionfile -if [ "${DISKSIZE} -lt "62914560" ] +if [ "${DISKSIZE}" -lt "62914560" ] then - echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --size=10240 --percent=85" >>/tmp/partitionfile + echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --percent=86" >>/tmp/partitionfile else echo "logvol / --fstype=$FSTYPE --name=root --vgname=xcatvg --grow --size=10240 --maxsize=20480" >>/tmp/partitionfile echo "logvol /var --fstype=$FSTYPE --name=var --vgname=xcatvg --grow --size=4096 --maxsize=8192" >>/tmp/partitionfile echo "logvol /tmp --fstype=$FSTYPE --name=tmp --vgname=xcatvg --grow --size=4096 --maxsize=8192" >>/tmp/partitionfile - echo "logvol /home --fstype=$FSTYPE --name=home --vgname=xcatvg --grow --percent=10 --size=1024 --maxsize=10240" >>/tmp/partitionfile + echo "logvol /home --fstype=$FSTYPE --name=home --vgname=xcatvg --grow --percent=10 --maxsize=10240" >>/tmp/partitionfile fi # Specify "bootloader" configuration in "/tmp/partitionfile" if there is no user customized partition file From b2dd4a5a56667bb11c82e35cb83846e4bcb139a1 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 17 Apr 2019 15:34:25 +0800 Subject: [PATCH 4/5] Revise error handling for function getdisksize() --- xCAT-server/share/xcat/install/scripts/pre.rhels8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index 4cb204623..2fb50c424 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -225,10 +225,11 @@ getdisksize() if [ "${name}" = "${disk}" ] then echo "${blocks}" - break + return fi done Date: Wed, 17 Apr 2019 15:36:38 +0800 Subject: [PATCH 5/5] Revise error handling for function getdisksize() --- xCAT-server/share/xcat/install/scripts/pre.rhels8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index 2fb50c424..c98667d42 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -214,7 +214,7 @@ getdisksize() disk="${disk#/dev/}" - [ -z "${disk}" ] && return + [ -z "${disk}" ] && echo "0" && return local blah local blocks