2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-24 15:05:36 +00:00

Add boot nvme support and filter small devices (#4778)

nvme devices were not autosensed as install candidates.

Also, devices smaller than 128 MB are filtered out, as they are likely
to be some media or similar.
This commit is contained in:
Jarrod Johnson
2018-02-22 21:32:34 -05:00
committed by yangsong
parent 41c86021be
commit 2ca56404d9

View File

@ -37,13 +37,19 @@ if [ -z "$install_disk" ]; then
# Get all partitions and disks from /proc/partitions file
if [ -z "$has_awk" ]; then
entries=$(cat /proc/partitions | sed 's/ */ /g' | cut -d " " -f5 | grep -v "name" | grep -e "[s|h|v]d.*$")
entries=$(cat /proc/partitions | sed 's/ */ /g' | cut -d " " -f5 | grep -v "name" | grep -E '^[s|h|v]d|nvme')
else
entries=$(awk -F ' ' '{print $4}' /proc/partitions | grep -v "name" | grep -e "[s|h|v]d.*$")
entries=$(awk -F ' ' '{print $4}' /proc/partitions | grep -v "name" | grep -E '^[s|h|v]d|nvme')
fi
# Classify entries by DEVTYPE
for entry in $entries; do
DEVSIZE=$(udevadm info --attribute-walk --name=$entry|grep size| sed -e 's/[^"]*"//' -e 's/"//'|tail -n 1)
if [ -z "$DEVSIZE" -o $DEVSIZE -lt 262144 ]; then
# ignore small devices, that are likely remote media or similar
continue
fi
if [ -z "$has_awk" ]; then
dev_type=$(udevadm info --query=property --name=/dev/$entry | grep -i "DEVTYPE" | cut -d "=" -f2 | $utolcmd)
else