mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-01-22 13:31:02 +08:00
fiz: Ignore sector size for whole disk passthrough (#1121)
This commit is contained in:
@@ -573,6 +573,12 @@ addDevice () {
|
|||||||
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
|
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
|
||||||
|
|
||||||
local sectors=""
|
local sectors=""
|
||||||
|
local dev_type=""
|
||||||
|
dev_type=$(lsblk -no TYPE "$DISK_DEV" 2>/dev/null | head -n1)
|
||||||
|
|
||||||
|
# Only detect and apply sector sizes for partitions, not whole disks
|
||||||
|
# Whole disk passthrough with explicit sector sizes causes DSM not to recognize the disk
|
||||||
|
if [[ "$dev_type" == "part" ]]; then
|
||||||
local result logical physical
|
local result logical physical
|
||||||
result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-)
|
result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-)
|
||||||
logical="${result%% *}"
|
logical="${result%% *}"
|
||||||
@@ -586,6 +592,7 @@ addDevice () {
|
|||||||
else
|
else
|
||||||
warn "Failed to determine the sector size for $DISK_DEV"
|
warn "Failed to determine the sector size for $DISK_DEV"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors")
|
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user