Skip to content

Commit f62b85d

Browse files
authored
fix fsvm-init.yml to detect virtio-scsi in kvm (#11070)
* fix fsvm-init.yml to detect virtio-scsi in kvm * Update fsvm-init.yml to handle universal block device case.
1 parent a87c5c2 commit f62b85d

File tree

1 file changed

+3
-8
lines changed
  • plugins/storage/sharedfs/storagevm/src/main/resources/conf

1 file changed

+3
-8
lines changed

plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,9 @@ write_files:
3030
}
3131
3232
get_block_device() {
33-
if [ "$HYPERVISOR" == "kvm" ]; then
34-
BLOCK_DEVICE="vdb"
35-
elif [ "$HYPERVISOR" == "xenserver" ]; then
36-
BLOCK_DEVICE="xvdb"
37-
elif [ "$HYPERVISOR" == "vmware" ]; then
38-
BLOCK_DEVICE="sdb"
39-
else
40-
log "Unknown hypervisor"
33+
BLOCK_DEVICE=$(lsblk -dn -o NAME,TYPE | awk '$2=="disk"{print $1}' | tail -n 1)
34+
if [ -z "$BLOCK_DEVICE" ]; then
35+
log "Unknown data disk"
4136
exit 1
4237
fi
4338
echo "$BLOCK_DEVICE"

0 commit comments

Comments
 (0)