added get bay number

This commit is contained in:
2025-03-01 13:34:53 -05:00
parent 54c5955f32
commit d2b14ed43a

View File

@ -32,6 +32,19 @@ get_drives_info() {
done
}
get_bay_number() {
local drive=$1
local path=$(readlink -f "/dev/disk/by-path/"*$(basename "$drive"))
# Extract bay number from the path based on medium2's mapping
for mapping in ${DRIVE_MAPPINGS[medium2]}; do
if [[ $path =~ $mapping ]]; then
echo "${mapping##*:}"
return
fi
done
}
get_physical_mapping() {
local -A drive_map