mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 01:39:48 +00:00
runtime-rs: add support kata/multi-containers sharing one vfio volume.
Fiexes: #8300 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
parent
b952c5c5ce
commit
e3becea566
@ -34,7 +34,6 @@ impl VfioVolume {
|
||||
d: &RwLock<DeviceManager>,
|
||||
m: &oci::Mount,
|
||||
read_only: bool,
|
||||
cid: &str,
|
||||
sid: &str,
|
||||
) -> Result<Self> {
|
||||
let mnt_src: &str = &m.source;
|
||||
@ -59,11 +58,6 @@ impl VfioVolume {
|
||||
.await
|
||||
.context("do handle device failed.")?;
|
||||
|
||||
// generate host guest shared path
|
||||
let guest_path = generate_shared_path(m.destination.clone(), read_only, cid, sid)
|
||||
.await
|
||||
.context("generate host-guest shared path failed")?;
|
||||
|
||||
let storage_options = if read_only {
|
||||
vec!["ro".to_string()]
|
||||
} else {
|
||||
@ -72,7 +66,6 @@ impl VfioVolume {
|
||||
|
||||
let mut storage = agent::Storage {
|
||||
options: storage_options,
|
||||
mount_point: guest_path.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@ -84,6 +77,12 @@ impl VfioVolume {
|
||||
storage.source = device.config.virt_path.unwrap().1;
|
||||
}
|
||||
|
||||
// generate host guest shared path
|
||||
let guest_path = generate_shared_path(m.destination.clone(), read_only, &device_id, sid)
|
||||
.await
|
||||
.context("generate host-guest shared path failed")?;
|
||||
storage.mount_point = guest_path.clone();
|
||||
|
||||
if m.r#type != "bind" {
|
||||
storage.fs_type = v.fs_type.clone();
|
||||
} else {
|
||||
|
@ -91,7 +91,7 @@ impl VolumeResource {
|
||||
)
|
||||
} else if is_vfio_volume(m) {
|
||||
Arc::new(
|
||||
VfioVolume::new(d, m, read_only, cid, sid)
|
||||
VfioVolume::new(d, m, read_only, sid)
|
||||
.await
|
||||
.with_context(|| format!("new vfio volume {:?}", m))?,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user