mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-25 14:18:54 +00:00
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 <alex.lyn@antgroup.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
346b9e38e2
commit
22f2d57e4f
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user