Commit 352cd100 authored by Kirill Smelkov's avatar Kirill Smelkov

X neotest: Fix disk display in case of MD

it was e.g.:

	lsblk: /dev/md: not a block device
	lsblk: /dev/md: not a block device
	# md:   rev

now:

	# md1 (raid0) -> sda3  sdb3
	# sda: SAMSUNG MZ7LN256  rev 100Q 238.5G
	# sdb: SAMSUNG MZ7LN256  rev 100Q 238.5G
parent f06b7302
...@@ -556,12 +556,32 @@ system_info() { ...@@ -556,12 +556,32 @@ system_info() {
# disk under . # disk under .
mntpt=`stat -c '%m' .` # mountpoint of current filesystem mntpt=`stat -c '%m' .` # mountpoint of current filesystem
mntdev=`findmnt -n -o source $mntpt` # mountpoint -> device blkdev=`findmnt -n -o source $mntpt` # mountpoint -> device
blkdev=`echo $mntdev |sed -e 's/[0-9]*$//'` # /dev/sda3 -> /dev/sda blkdev1=`basename $blkdev` # /dev/sda -> sda
# showblk1 <device>
showblk1() {
blkdev=$1
blkdev1=`basename $blkdev` # /dev/sda -> sda blkdev1=`basename $blkdev` # /dev/sda -> sda
# XXX lsblk: tmpfs: not a block device # XXX lsblk: tmpfs: not a block device
# XXX lsblk: /dev/md: not a block device
echo "# $blkdev1: `lsblk -dn -o MODEL $blkdev` rev `lsblk -dn -o REV,SIZE $blkdev`" echo "# $blkdev1: `lsblk -dn -o MODEL $blkdev` rev `lsblk -dn -o REV,SIZE $blkdev`"
}
case "$blkdev1" in
md*)
# software raid
slavev=`ls -x /sys/class/block/$blkdev1/slaves`
echo "# $blkdev1 (`cat /sys/class/block/$blkdev1/md/level`) -> $slavev"
for s in $slavev; do
s=`echo $s |sed -e 's/[0-9]*$//'` # sda3 -> sda
showblk1 /dev/$s
done
;;
*)
blkdev_main=`echo $blkdev |sed -e 's/[0-9]*$//'` # /dev/sda3 -> /dev/sda
showblk1 $blkdev_main
;;
esac
# all NICs # all NICs
# XXX warn if ethtool is not there # XXX warn if ethtool is not there
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment