mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-20 02:10:46 +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>,
|
d: &RwLock<DeviceManager>,
|
||||||
m: &oci::Mount,
|
m: &oci::Mount,
|
||||||
read_only: bool,
|
read_only: bool,
|
||||||
cid: &str,
|
|
||||||
sid: &str,
|
sid: &str,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let mnt_src: &str = &m.source;
|
let mnt_src: &str = &m.source;
|
||||||
@ -59,11 +58,6 @@ impl VfioVolume {
|
|||||||
.await
|
.await
|
||||||
.context("do handle device failed.")?;
|
.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 {
|
let storage_options = if read_only {
|
||||||
vec!["ro".to_string()]
|
vec!["ro".to_string()]
|
||||||
} else {
|
} else {
|
||||||
@ -72,7 +66,6 @@ impl VfioVolume {
|
|||||||
|
|
||||||
let mut storage = agent::Storage {
|
let mut storage = agent::Storage {
|
||||||
options: storage_options,
|
options: storage_options,
|
||||||
mount_point: guest_path.clone(),
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,6 +77,12 @@ impl VfioVolume {
|
|||||||
storage.source = device.config.virt_path.unwrap().1;
|
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" {
|
if m.r#type != "bind" {
|
||||||
storage.fs_type = v.fs_type.clone();
|
storage.fs_type = v.fs_type.clone();
|
||||||
} else {
|
} else {
|
||||||
|
@ -91,7 +91,7 @@ impl VolumeResource {
|
|||||||
)
|
)
|
||||||
} else if is_vfio_volume(m) {
|
} else if is_vfio_volume(m) {
|
||||||
Arc::new(
|
Arc::new(
|
||||||
VfioVolume::new(d, m, read_only, cid, sid)
|
VfioVolume::new(d, m, read_only, sid)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("new vfio volume {:?}", m))?,
|
.with_context(|| format!("new vfio volume {:?}", m))?,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user