From 82f2f95595a3342c4cdf457a042fa31c1167dd85 Mon Sep 17 00:00:00 2001 From: levindecaro <36956864+levindecaro@users.noreply.github.com> Date: Sun, 22 Jun 2025 16:01:27 +0800 Subject: [PATCH 1/2] fix fsvm-init.yml to detect virtio-scsi in kvm --- .../sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml b/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml index 4d3572162c8a..e2842d7f6aa1 100644 --- a/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml +++ b/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml @@ -31,7 +31,7 @@ write_files: get_block_device() { if [ "$HYPERVISOR" == "kvm" ]; then - BLOCK_DEVICE="vdb" + lspci | grep "Virtio SCSI" > /dev/null && BLOCK_DEVICE="sdb" || BLOCK_DEVICE="vdb" elif [ "$HYPERVISOR" == "xenserver" ]; then BLOCK_DEVICE="xvdb" elif [ "$HYPERVISOR" == "vmware" ]; then From 8bb8e86bd2ab91a7a0a841b9afe47dca820097f0 Mon Sep 17 00:00:00 2001 From: levindecaro <36956864+levindecaro@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:54:07 +0800 Subject: [PATCH 2/2] Update fsvm-init.yml to handle universal block device case. --- .../storagevm/src/main/resources/conf/fsvm-init.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml b/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml index e2842d7f6aa1..ceafa6c3cb10 100644 --- a/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml +++ b/plugins/storage/sharedfs/storagevm/src/main/resources/conf/fsvm-init.yml @@ -30,14 +30,9 @@ write_files: } get_block_device() { - if [ "$HYPERVISOR" == "kvm" ]; then - lspci | grep "Virtio SCSI" > /dev/null && BLOCK_DEVICE="sdb" || BLOCK_DEVICE="vdb" - elif [ "$HYPERVISOR" == "xenserver" ]; then - BLOCK_DEVICE="xvdb" - elif [ "$HYPERVISOR" == "vmware" ]; then - BLOCK_DEVICE="sdb" - else - log "Unknown hypervisor" + BLOCK_DEVICE=$(lsblk -dn -o NAME,TYPE | awk '$2=="disk"{print $1}' | tail -n 1) + if [ -z "$BLOCK_DEVICE" ]; then + log "Unknown data disk" exit 1 fi echo "$BLOCK_DEVICE"