mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-04-26 18:43:06 +00:00
agent: Add virtio-scsi for multilayer erofs storage handler
It aims to suppport virtio-scsi driver for handling vmdk and rwlayer storage in kata-agent. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
37a542c20f
commit
c745d18e00
@@ -16,12 +16,14 @@ use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::device::block_device_handler::get_virtio_blk_pci_device_name;
|
||||
use crate::device::scsi_device_handler::get_scsi_device_name;
|
||||
use crate::linux_abi::pcipath_from_dev_tree_path;
|
||||
use crate::mount::baremount;
|
||||
use crate::sandbox::Sandbox;
|
||||
use crate::storage::{StorageContext, StorageHandler};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use kata_sys_util::mount::create_mount_destination;
|
||||
use kata_types::device::{DRIVER_BLK_PCI_TYPE, DRIVER_SCSI_TYPE};
|
||||
use kata_types::mount::StorageDevice;
|
||||
use protocols::agent::Storage;
|
||||
use safe_path::scoped_join;
|
||||
@@ -466,8 +468,30 @@ async fn wait_and_mount_layer(
|
||||
sandbox: &Arc<Mutex<Sandbox>>,
|
||||
logger: &Logger,
|
||||
) -> Result<()> {
|
||||
let (root_complex, pcipath) = pcipath_from_dev_tree_path(&layer.source)?;
|
||||
let dev_path = get_virtio_blk_pci_device_name(sandbox, root_complex, &pcipath).await?;
|
||||
info!(
|
||||
logger,
|
||||
"Waiting for layer device";
|
||||
"device" => &layer.source,
|
||||
"driver" => &layer.driver,
|
||||
"mount-point" => layer_mount.display(),
|
||||
);
|
||||
let dev_path = match layer.driver.as_str() {
|
||||
DRIVER_SCSI_TYPE => {
|
||||
// For SCSI devices, we need to wait for the device to appear and get its path before mounting.
|
||||
get_scsi_device_name(sandbox, &layer.source).await?
|
||||
}
|
||||
DRIVER_BLK_PCI_TYPE => {
|
||||
let (root_complex, pcipath) = pcipath_from_dev_tree_path(&layer.source)?;
|
||||
get_virtio_blk_pci_device_name(sandbox, root_complex, &pcipath).await?
|
||||
}
|
||||
_ => {
|
||||
// For non-SCSI devices, we can assume the source is directly mountable.
|
||||
return Err(anyhow!(
|
||||
"unsupported driver type '{}' for multi-layer erofs",
|
||||
layer.driver
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
info!(
|
||||
logger,
|
||||
|
||||
Reference in New Issue
Block a user