mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
runtime-rs: add support kata/multi-containers sharing one spdk volume.
Fiexes: #8300 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
@@ -36,7 +36,6 @@ impl SPDKVolume {
|
||||
d: &RwLock<DeviceManager>,
|
||||
m: &oci::Mount,
|
||||
read_only: bool,
|
||||
cid: &str,
|
||||
sid: &str,
|
||||
) -> Result<Self> {
|
||||
let mnt_src: &str = &m.source;
|
||||
@@ -100,23 +99,16 @@ impl SPDKVolume {
|
||||
.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")?;
|
||||
|
||||
// storage
|
||||
let mut storage = agent::Storage {
|
||||
mount_point: guest_path.clone(),
|
||||
options: if read_only {
|
||||
vec!["ro".to_string()]
|
||||
} else {
|
||||
Vec::new()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
storage.options = if read_only {
|
||||
vec!["ro".to_string()]
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
let mut device_id = String::new();
|
||||
if let DeviceType::VhostUserBlk(device) = device_info {
|
||||
// blk, mmioblk
|
||||
@@ -126,6 +118,12 @@ impl SPDKVolume {
|
||||
device_id = device.device_id;
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
@@ -97,7 +97,7 @@ impl VolumeResource {
|
||||
)
|
||||
} else if is_spdk_volume(m) {
|
||||
Arc::new(
|
||||
SPDKVolume::new(d, m, read_only, cid, sid)
|
||||
SPDKVolume::new(d, m, read_only, sid)
|
||||
.await
|
||||
.with_context(|| format!("create spdk volume {:?}", m))?,
|
||||
)
|
||||
|
Reference in New Issue
Block a user