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 <alex.lyn@antgroup.com>
This commit is contained in:
Alex Lyn
2026-07-10 12:50:09 +08:00
committed by Fabiano Fidêncio
parent 0544de8eb4
commit 3537b18768
3 changed files with 6 additions and 6 deletions

View File

@@ -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),

View File

@@ -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.")?;
}

View File

@@ -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<Option<BlockConfig>> {
async fn prepare_rootfs_config(&self) -> Result<Option<BlockConfigModern>> {
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,