2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-03 03:50:08 +00:00

Merge pull request #835 from xuweibj/I822

To fix issue 822, run getinstdisk script when install rh6.7
This commit is contained in:
zet809 2016-03-24 16:00:46 +08:00
commit d3807e08e6
2 changed files with 13 additions and 43 deletions

View File

@ -24,6 +24,8 @@ mkdir -p $tmpdir
has_awk=$(find / -name "awk")
utolcmd="sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
tmpfile=$tmpdir"/getinstalldisk_"
if [ -z "$install_disk" ]; then
@ -42,9 +44,9 @@ if [ -z "$install_disk" ]; then
# Classify entries by DEVTYPE
for entry in $entries; do
if [ -z "$has_awk" ]; then
dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | cut -d "=" -f2 | tr A-Z a-z)
dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | cut -d "=" -f2 | $utolcmd)
else
dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | awk -F = '{print $2}' | tr A-Z a-z)
dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | awk -F = '{print $2}' | $utolcmd)
fi
if [ "$dev_type" == "disk" ]; then
@ -129,10 +131,12 @@ if [ -z "$install_disk" ]; then
for disk in $disks; do
# Get disk's information: WWN, PATH and DRIVER
disk_info=$(udevadm info --query=property --name=$disk)
disk_wwn=$(IFS= ;echo $disk_info | grep '\<ID_WWN\>' | cut -d "=" -f2 | tr A-Z a-z)
disk_path=$(IFS= ;echo $disk_info | grep DEVPATH | cut -d "=" -f2 | tr A-Z a-z)
output_for_wwn=$(echo $disk_info | grep '\<ID_WWN\>' | cut -d "=" -f2 | $utolcmd)
disk_wwn=$(IFS= ;echo $output_for_wwn)
output_for_path=$(echo $disk_info | grep DEVPATH | cut -d "=" -f2 | $utolcmd)
disk_path=$(IFS= ;echo $output_for_path)
disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'|
\head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | tr A-Z a-z)
\head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | $utolcmd)
echo "[get_install_disk]The disk $disk information: "
echo "[get_install_disk] disk_wwn=$disk_wwn"

View File

@ -184,45 +184,11 @@ 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
fi
if [ -z "$instdisk" ]; then
if [ ! -z "$firstdirectdisk" ]; then
instdisk=$firstdirectdisk
elif [ ! -z "$probablyfirstdirectdisk" ]; then
instdisk=$probablyfirstdirectdisk
elif [ ! -z "$firstdisk" ]; then
instdisk=$firstdisk
fi
#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,