On 09/10/2010 05:49 PM, Peter Bittner wrote:
Great, I kind of made it. Not easy to find out how to check what paths
are not accessible (i.e. which disks get a read error when setup-storage
goes over them.
I think the most promising way would be a hook that modifies the contents of the
"disklist" variable. By default, its contents is determined by reading
/proc/partitions in FAI's disk-info script. If you add a hook
partition.DEFAULT.source that changes $disklist in an appropriate way I guess
you should readily get some reliable results.
For everyone interested, here is my solution:
Strangely enough I had the some problem several weeks ago. I also set
out to overwrite the disklist variable. My solution is a bit different
though.
I have an environment variable that can set the allowed disk types
(model vendor pair) for a class or a specific machine.
In the hook I use this information to construct the correct disk list.
I have attached the hook, in my CLASS.var file I have:
valid_disks[1]="PERC 6/i DELL"
valid_disks[2]="vbd"
Rudy
new_disklist=""
for disk in $disklist
do
if [ -e /sys/block/$disk/device/model ] && [ -e
/sys/block/$disk/device/vendor ]
then
model=`cat /sys/block/$disk/device/model | sed -e 's/^ \+//' -e
's/ \+$//' -e 's/ \+/ /g'`
vendor=`cat /sys/block/$disk/device/vendor | sed -e 's/^ \+//'
-e 's/ \+$//' -e 's/ \+/ /g'`
model_vendor="$model $vendor"
elif [ -e /sys/block/$disk/device/devtype ]
then
model_vendor=`cat /sys/block/$disk/device/devtype`
fi
for valid_disk in "${valid_dis...@]}"
do
if [ "$model_vendor" = "$valid_disk" ]
then
if [ -z $new_disklist ]
then
new_disklist=$disk
else
new_disklist="${disk} ${new_disklist}"
fi
fi
done
done
disklist=`echo $new_disklist | tr " " "\n"|sort`
echo Valid disks: $disklist