From 3537b187685db3a44253ba3027642d38e94fbbc0 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Fri, 10 Jul 2026 12:50:09 +0800 Subject: [PATCH] runtime-rs: Use BlockConfigModern for VM rootfs Switch the VmRootfs resource path from BlockConfig to BlockConfigModern so the VM rootfs is handled through the modern block device pipeline, consistent with the recent BlockModern migration for block volumes. This changes ResourceConfig::VmRootfs to wrap BlockConfigModern, routes its handling through DeviceConfig::BlockCfgModern, and updates prepare_rootfs_config() in virt_container to build a BlockConfigModern. Signed-off-by: Alex Lyn --- src/runtime-rs/crates/resource/src/lib.rs | 5 ++--- src/runtime-rs/crates/resource/src/manager_inner.rs | 2 +- src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime-rs/crates/resource/src/lib.rs b/src/runtime-rs/crates/resource/src/lib.rs index 7f391567fd..223007dec0 100644 --- a/src/runtime-rs/crates/resource/src/lib.rs +++ b/src/runtime-rs/crates/resource/src/lib.rs @@ -18,8 +18,7 @@ mod manager_inner; pub mod network; pub mod resource_persist; use hypervisor::{ - vfio_device::VfioDeviceBase, BlockConfig, HybridVsockConfig, PortDeviceConfig, - ProtectionDeviceConfig, VsockConfig, + BlockConfig, BlockConfigModern, HybridVsockConfig, PortDeviceConfig, ProtectionDeviceConfig, VsockConfig, vfio_device::VfioDeviceBase, }; use network::NetworkConfig; pub mod rootfs; @@ -36,7 +35,7 @@ use kata_types::config::hypervisor::SharedFsInfo; pub enum ResourceConfig { Network(NetworkConfig), ShareFs(SharedFsInfo), - VmRootfs(BlockConfig), + VmRootfs(BlockConfigModern), GuestExtensionImage(BlockConfig), HybridVsock(HybridVsockConfig), Vsock(VsockConfig), diff --git a/src/runtime-rs/crates/resource/src/manager_inner.rs b/src/runtime-rs/crates/resource/src/manager_inner.rs index 08bb268f9f..d47797aaf8 100644 --- a/src/runtime-rs/crates/resource/src/manager_inner.rs +++ b/src/runtime-rs/crates/resource/src/manager_inner.rs @@ -185,7 +185,7 @@ impl ResourceManagerInner { .context("failed to handle network")?; } ResourceConfig::VmRootfs(r) => { - do_handle_device(&self.device_manager, &DeviceConfig::BlockCfg(r)) + do_handle_device(&self.device_manager, &DeviceConfig::BlockCfgModern(r)) .await .context("do handle device failed.")?; } diff --git a/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs b/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs index fb9b3dd710..dc3e5b9586 100644 --- a/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs +++ b/src/runtime-rs/crates/runtimes/virt_container/src/sandbox.rs @@ -33,6 +33,7 @@ use hypervisor::ch::CloudHypervisor; use hypervisor::device::topology::PCIePort; use hypervisor::device::util::{get_host_path, DEVICE_TYPE_CHAR}; use hypervisor::remote::Remote; +use hypervisor::{BlockConfigModern, VfioDeviceBase, is_vfio_ap_device}; use hypervisor::VsockConfig; use hypervisor::HYPERVISOR_REMOTE; #[cfg(all( @@ -643,7 +644,7 @@ impl VirtSandbox { Ok(()) } - async fn prepare_rootfs_config(&self) -> Result> { + async fn prepare_rootfs_config(&self) -> Result> { let boot_info = self.hypervisor.hypervisor_config().await.boot_info; let security_info = self.hypervisor.hypervisor_config().await.security_info; @@ -663,7 +664,7 @@ impl VirtSandbox { } } - Ok(Some(BlockConfig { + Ok(Some(BlockConfigModern { path_on_host: boot_info.image.clone(), is_readonly: true, driver_option: boot_info.vm_rootfs_driver,