From fbd84fd3f437c3bbaa19289843c7474a4d27ce67 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Wed, 23 Jul 2025 15:59:51 +0800 Subject: [PATCH] runtime-rs: Support virtio-scsi device within handle_block_volume It supports handling scsi device when block device driver is `scsi`. And it will ensure a correct storage source with LUN. Fixes #11516 Signed-off-by: alex.lyn --- src/runtime-rs/crates/resource/src/volume/utils.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/runtime-rs/crates/resource/src/volume/utils.rs b/src/runtime-rs/crates/resource/src/volume/utils.rs index 188414beb0..7c54a4266a 100644 --- a/src/runtime-rs/crates/resource/src/volume/utils.rs +++ b/src/runtime-rs/crates/resource/src/volume/utils.rs @@ -26,6 +26,7 @@ pub const DEFAULT_VOLUME_FS_TYPE: &str = "ext4"; pub const KATA_MOUNT_BIND_TYPE: &str = "bind"; pub const KATA_BLK_DEV_TYPE: &str = "blk"; +pub const KATA_SCSI_DEV_TYPE: &str = "scsi"; pub fn get_file_name>(src: P) -> Result { let file_name = src @@ -99,6 +100,13 @@ pub async fn handle_block_volume( return Err(anyhow!("block driver is blk but no pci path exists")); } } + KATA_SCSI_DEV_TYPE => { + if let Some(scsi_addr) = device.config.scsi_addr { + scsi_addr.to_string() + } else { + return Err(anyhow!("block driver is scsi but no scsi address exists")); + } + } _ => device.config.virt_path, }; device_id = device.device_id;