runtime-rs: Use BlockConfigModern for block rootfs

Migrate the block config from BlockConfig to BlockConfigModern,
routing it through DeviceConfig::BlockCfgModern for block rootfs.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
Alex Lyn
2026-07-08 19:44:42 +08:00
committed by Fabiano Fidêncio
parent 71b66d1988
commit ee64539976

View File

@@ -10,11 +10,9 @@ use agent::Storage;
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use hypervisor::{
device::{
device_manager::{do_handle_device, get_block_device_info, DeviceManager},
DeviceConfig, DeviceType,
BlockConfigModern, BlockDeviceAio, device::{
DeviceConfig, DeviceType, device_manager::{DeviceManager, do_handle_device, get_block_device_info},
},
BlockConfig, BlockDeviceAio,
};
use kata_types::config::hypervisor::{
VIRTIO_BLK_CCW, VIRTIO_BLK_MMIO, VIRTIO_BLK_PCI, VIRTIO_PMEM, VIRTIO_SCSI,
@@ -52,7 +50,7 @@ impl BlockRootfs {
let blkdev_info = get_block_device_info(d).await;
let block_driver = blkdev_info.block_device_driver.clone();
let block_device_config = &mut BlockConfig {
let block_device_config = &mut BlockConfigModern {
major: stat::major(dev_id) as i64,
minor: stat::minor(dev_id) as i64,
driver_option: block_driver.clone(),
@@ -66,7 +64,7 @@ impl BlockRootfs {
};
// create and insert block device into Kata VM
let device_info = do_handle_device(d, &DeviceConfig::BlockCfg(block_device_config.clone()))
let device_info = do_handle_device(d, &DeviceConfig::BlockCfgModern(block_device_config.clone()))
.await
.context("do handle device failed.")?;
@@ -88,7 +86,8 @@ impl BlockRootfs {
}
let mut device_id: String = "".to_owned();
if let DeviceType::Block(device) = device_info {
if let DeviceType::BlockModern(device_mod) = device_info {
let device = device_mod.lock().await.clone();
storage.driver = device.config.driver_option;
device_id = device.device_id;