From fdca2cc3f959140df18d65dce67f485a9be8f850 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 11 Dec 2015 03:55:29 -0500 Subject: [PATCH] replace the determine install disk precess with script share/xcat/install/scripts/getinstdisk, it will write the install disk to /tmp/install_disk --- .../common/deployment/cfg_partition.rst | 8 +-- .../references/man5/linuximage.5.rst | 2 +- .../references/man7/osimage.7.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT-server/lib/perl/xCAT/Template.pm | 6 +- .../share/xcat/install/scripts/pre.pkvm3 | 45 ++------------- .../share/xcat/install/scripts/pre.rh.rhels7 | 41 ++------------ .../share/xcat/install/scripts/pre.sles | 45 ++++----------- .../share/xcat/install/scripts/pre.ubuntu | 7 +++ .../xcat/install/scripts/pre.ubuntu.ppc64 | 7 +++ .../share/xcat/install/ubuntu/compute.tmpl | 56 +------------------ 11 files changed, 43 insertions(+), 178 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst index 64856b5a1..6fa84715f 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/cfg_partition.rst @@ -467,13 +467,13 @@ If not specified, the default value will be used. nodeset osimage= - the 'd:' preceding the filename tells nodeset that this is a partition disk file. -- For Ubuntu, when nodeset runs and generates the /install/autoinst file for a node, it will generate a script to write the content of the partition disk file to /tmp/boot_disk, this context to run the script will replace the #XCA_PARTMAN_DISK_SCRIPT# directive in /install/autoinst/.pre. +- For Ubuntu, when nodeset runs and generates the /install/autoinst file for a node, it will generate a script to write the content of the partition disk file to /tmp/install_disk, this context to run the script will replace the #XCA_PARTMAN_DISK_SCRIPT# directive in /install/autoinst/.pre. .. END_Partition_Disk_File_ubuntu_only .. BEGIN_Partition_Disk_Script_ubuntu_only -The disk script contains a script to generate a partitioning disk file named "/tmp/boot_disk". for example: :: +The disk script contains a script to generate a partitioning disk file named "/tmp/install_disk". for example: :: rm /tmp/devs-with-boot 2>/dev/null || true; for d in $(list-devices partition); do @@ -486,12 +486,12 @@ The disk script contains a script to generate a partitioning disk file named "/t fi done; if [[ -e /tmp/devs-with-boot ]]; then - head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; + head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/install_disk; rm /tmp/devs-with-boot 2>/dev/null || true; else DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*[s|h|v]d[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o '[s|h|v]d.*$'`; if [[ "$DEV" == "" ]]; then DEV="sda"; fi; - echo "/dev/$DEV" > /tmp/boot_disk; + echo "/dev/$DEV" > /tmp/install_disk; fi; If not specified, the default value will be used. diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index df657a557..1028e48ac 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -158,7 +158,7 @@ linuximage Attributes: \ **partitionfile**\ - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/boot_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index 0b43df13b..23ac6bd49 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -279,7 +279,7 @@ osimage Attributes: \ **partitionfile**\ (linuximage.partitionfile, winimage.partitionfile) - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/boot_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," or diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 86f7d87dd..db556f804 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -779,7 +779,7 @@ linuximage => { permission => 'The mount permission of /.statelite directory is used, its default value is 755', dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs:///". If you want to use the node's "xcatmaster" (its SN or MN), can be left blank. For example, "nfs:///" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.}, crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.', - partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/boot_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', + partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 9d33392f4..312bb123e 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -426,7 +426,7 @@ sub subvars { if ($diskfile && $doneincludes) { - #the content of the specified file is the disknames to partition or a script which can write disk names into /tmp/boot_disk + #the content of the specified file is the disknames to partition or a script which can write disk names into /tmp/install_disk # split the disk file out from the $inc ($inc, $diskcontent) = split(/FFFFFFFFFFFFPARTITIONDISKFILESTART\n/, $inc); ($diskcontent,$res) = split(/\nFFFFFFFFFFFFPARTITIONDISKFILEEND/, $diskcontent); @@ -449,8 +449,8 @@ sub subvars { $diskcontent .= "/tmp/diskscript\n"; }else{ # Put the code to decode the preseed disk file - #$diskcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/diskscript.enc\",\"rb\").read())' >/tmp/boot_disk\n"; - $diskcontent .= "base64decode/tmp/boot_disk\n"; + #$diskcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/diskscript.enc\",\"rb\").read())' >/tmp/install_disk\n"; + $diskcontent .= "base64decode/tmp/install_disk\n"; } #replace the #XCA_PARTMAN_DISK_SCRIPT# diff --git a/xCAT-server/share/xcat/install/scripts/pre.pkvm3 b/xCAT-server/share/xcat/install/scripts/pre.pkvm3 index 7ddca1fa2..bda6cced5 100755 --- a/xCAT-server/share/xcat/install/scripts/pre.pkvm3 +++ b/xCAT-server/share/xcat/install/scripts/pre.pkvm3 @@ -3,55 +3,18 @@ shopt -s nullglob -#first take the disk with the MAX WWN numer to be the installdisk -if [ -z "$instdisk" ]; then - disks=$(awk -F' ' '{print $4 }' /proc/partitions |grep -e "sd[a-z]\+$") - for disk in $disks; do - diskinfo=$(udevadm info --name $disk) - diskname=$(IFS= ;echo $diskinfo|grep '\'|cut -d "=" -f2|tr A-Z a-z) - devtype=$(IFS= ;echo $diskinfo|grep '\'|cut -d "=" -f2|tr A-Z a-z) - devwwn=$(IFS= ;echo $diskinfo|grep '\'|cut -d "=" -f2|tr A-Z a-z) - [ "$devtype" != "disk" ] && continue - diskentry=$diskentry"$diskname $devwwn\n" - done - instdisk=$(echo -e $diskentry|grep -v "^$"|sort -k 2 -b -r|cut -d" " -f1|head -n 1) +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# +if [ -e "/tmp/install_disk" ]; then + instdisk=`cat /tmp/install_disk` fi -#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... -if [ -z "$instdisk" ]; then - for disk in /dev/sd*[^0-9]; do - currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'` - case "$currdriver" in - "ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - "mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible - if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - *) - if [ -z "$firstdisk" ]; then firstdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - esac - done -fi - -if [ -z "$instdisk" ]; then - if [ ! -z "$firstdirectdisk" ]; then - instdisk=$firstdirectdisk - elif [ ! -z "$probablyfirstdirectdisk" ]; then - instdisk=$probablyfirstdirectdisk - elif [ ! -z "$firstdisk" ]; then - instdisk=$firstdisk - fi -fi # Could not determine the install disk for whatever reason, # try the default /dev/sda if [ -z "$instdisk" ]; then instdisk="/dev/sda" fi - - echo "part PV.01 --ondisk=$instdisk" >> /tmp/partitioning echo "volgroup ibmpkvm_rootvg PV.01" >> /tmp/partitioning diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 b/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 index feddc70f2..e241f9fdb 100755 --- a/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 +++ b/xCAT-server/share/xcat/install/scripts/pre.rh.rhels7 @@ -142,46 +142,13 @@ fi #also, find first available block device (sda or vda likely) #TODO: pick a likely non-SAN target if possible shopt -s nullglob -for disk in /dev/vd*[^0-9];do - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - eddname=$(/lib/udev/edd_id $disk 2> /dev/null) - if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then - instdisk=$disk - break - fi -done -if [ -z "$instdisk" ]; then - for disk in /dev/sd*[^0-9]; do - eddname=$(/lib/udev/edd_id $disk 2> /dev/null) - if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then - instdisk=$disk - break - fi - currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'` - case "$currdriver" in - "ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - "mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible - if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - *) - if [ -z "$firstdisk" ]; then firstdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - esac - done +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# +if [ -e "/tmp/install_disk" ]; then + instdisk=`cat /tmp/install_disk` fi -if [ -z "$instdisk" ]; then - if [ ! -z "$firstdirectdisk" ]; then - instdisk=$firstdirectdisk - elif [ ! -z "$probablyfirstdirectdisk" ]; then - instdisk=$probablyfirstdirectdisk - elif [ ! -z "$firstdisk" ]; then - instdisk=$firstdisk - fi -fi # Could not determine the install disk for whatever reason, # try the default /dev/sda if [ -z "$instdisk" ]; then diff --git a/xCAT-server/share/xcat/install/scripts/pre.sles b/xCAT-server/share/xcat/install/scripts/pre.sles index d54fa2387..18bf7bce4 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.sles +++ b/xCAT-server/share/xcat/install/scripts/pre.sles @@ -125,45 +125,20 @@ fi /tmp/foo.awk >/tmp/foo.log 2>&1 & shopt -s nullglob -for disk in /dev/vd*[^0-9];do - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - eddname=$(/lib/udev/edd_id $disk 2> /dev/null) - if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then - instdisk=$disk - break - fi -done -if [ -z "$instdisk" ]; then - for disk in /dev/sd*[^0-9]; do - eddname=$(/lib/udev/edd_id $disk 2> /dev/null) - if [ ! -z "$eddname" -a "$eddname" = "int13_dev80" ]; then - instdisk=$disk - break - fi - currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'` - case "$currdriver" in - "ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct - if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - "mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible - if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - *) - if [ -z "$firstdisk" ]; then firstdisk=$disk; fi #remember first disk as a guess of medium resort - ;; - esac - done + +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# +if [ -e "/tmp/install_disk" ]; then + instdisk=`cat /tmp/install_disk` fi + +# Could not determine the install disk for whatever reason, +# try the default /dev/sda if [ -z "$instdisk" ]; then - if [ ! -z "$firstdirectdisk" ]; then - instdisk=$firstdirectdisk - elif [ ! -z "$probablyfirstdirectdisk" ]; then - instdisk=$probablyfirstdirectdisk - elif [ ! -z "$firstdisk" ]; then - instdisk=$firstdisk - fi + instdisk="/dev/sda" fi + if [ -d /sys/firmware/efi ]; then sed -e 's!XCATPARTITIONHOOK!'$instdisk'vfat/boot/efi128mbswapauto/auto!' /tmp/profile/autoinst.xml > /tmp/profile/modified.xml else diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index 0ee54f33e..bd3172c6a 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -178,6 +178,13 @@ base64decode() done } +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# + +if [ ! -e /tmp/install_disk ]; then + echo "/dev/sda" > /tmp/install_disk +fi + if [ -d /sys/firmware/efi ]; then echo "ubuntu-efi ::" > /tmp/partitionfile echo " 512 512 1024 fat16" >> /tmp/partitionfile diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 index 9a92ba14a..eea5f261f 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 @@ -192,6 +192,13 @@ base64decode() done } +#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# + +if [ ! -e /tmp/install_disk ]; then + echo "/dev/sda" > /tmp/install_disk +fi + if [ -d /sys/firmware/efi ]; then echo "ubuntu-efi ::" > /tmp/partitionfile echo " 512 512 1024 fat16" >> /tmp/partitionfile diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 64c77a566..99ae18cf9 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -51,61 +51,7 @@ d-i partman-md/device_remove_md boolean true #create the /tmp/partitionfile based on the uefi or legacy bios d-i partman/early_command string \ - set -x; \ - if [ -f /tmp/boot_disk ]; then \ - debconf-set partman-auto/disk "$(cat /tmp/boot_disk)"; \ - exit; \ - fi; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - for d in $(list-devices partition); do \ - mkdir -p /tmp/mymount; \ - rc=0; \ - mount $d /tmp/mymount || rc=$?; \ - if [[ $rc -eq 0 ]]; then \ - [[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \ - for i in /tmp/mymount/vmlinuz* ; do \ - if [ -e $i ]; then \ - echo $d >>/tmp/devs-with-boot; break; \ - fi; \ - done; \ - umount /tmp/mymount; \ - fi; \ - done; \ - if [[ -e /tmp/devs-with-boot ]]; then \ - head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ - rm /tmp/devs-with-boot 2>/dev/null || true; \ - else \ - if [[ -e /tmp/disk_info ]]; then \ - rm -f /tmp/disk_info; \ - fi; \ - for disk in $(list-devices disk); do \ - diskbootable=''; \ - currdriver=`udevadm info -a -n $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'`; \ - case "$currdriver" in \ - "ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") \ - diskbootable=$disk; \ - ;; \ - "mptsas"|"mpt2sas"|"mpt3sas") \ - diskbootable=$disk; \ - ;; \ - *) \ - diskbootable=''; \ - ;; \ - esac; \ - if [ ! -z "$diskbootable" ]; then \ - devpath=`udevadm info $diskbootable | grep DEVPATH`; \ - echo $devpath ." $diskbootable" >> /tmp/disk_info; \ - fi; \ - done; \ - if [[ -e /tmp/disk_info ]]; then \ - DEV=`cat /tmp/disk_info | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o '/dev/[s|h|v]d.*$'`; \ - fi; \ - if [[ "$DEV" == "" ]]; then \ - DEV="/dev/sda"; \ - fi; \ - echo "$DEV" > /tmp/boot_disk; \ - fi; \ - debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" + debconf-set partman-auto/disk "$(cat /tmp/install_disk)" d-i partman-auto/expert_recipe_file string /tmp/partitionfile # This makes partman automatically partition without confirmation, provided