From 22f2d57e4f9ce983a73bfe92df18f03ece29cd3a Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Fri, 3 Jul 2026 16:18:45 +0800 Subject: [PATCH] runtime-rs: Move block volumes to BlockModern Build regular block volumes with BlockConfigModern and submit them through DeviceConfig::BlockCfgModern. Preserve the existing block device attributes while also recording the host path required by the modern block device model. Update block volume helper call sites with the default option slice so this change remains buildable with the modern helper signature. Signed-off-by: Alex Lyn --- .../crates/resource/src/volume/block_volume.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/runtime-rs/crates/resource/src/volume/block_volume.rs b/src/runtime-rs/crates/resource/src/volume/block_volume.rs index defbaf4b93..4ff3c58d6a 100644 --- a/src/runtime-rs/crates/resource/src/volume/block_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/block_volume.rs @@ -15,7 +15,7 @@ use hypervisor::{ device_manager::{do_handle_device, get_block_device_info, DeviceManager}, DeviceConfig, }, - BlockConfig, BlockDeviceAio, + BlockConfigModern, BlockDeviceAio, }; use kata_sys_util::mount::get_mount_path; use nix::sys::{stat, stat::SFlag}; @@ -59,7 +59,8 @@ impl BlockVolume { false }); - let block_device_config = BlockConfig { + let block_device_config = BlockConfigModern { + path_on_host: mnt_src.to_string_lossy().to_string(), major: stat::major(fstat.st_rdev) as i64, minor: stat::minor(fstat.st_rdev) as i64, is_readonly: read_only, @@ -73,9 +74,10 @@ impl BlockVolume { }; // create and insert block device into Kata VM - let device_info = do_handle_device(d, &DeviceConfig::BlockCfg(block_device_config.clone())) - .await - .context("do handle device failed.")?; + let device_info = + do_handle_device(d, &DeviceConfig::BlockCfgModern(block_device_config.clone())) + .await + .context("do handle device failed.")?; let block_volume = handle_block_volume(device_info, m, read_only, sid, DEFAULT_VOLUME_FS_TYPE, None)