mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-02 17:34:18 +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>,
|
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;
|
||||||
@@ -100,21 +99,14 @@ impl SPDKVolume {
|
|||||||
.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")?;
|
|
||||||
|
|
||||||
// storage
|
// storage
|
||||||
let mut storage = agent::Storage {
|
let mut storage = agent::Storage {
|
||||||
mount_point: guest_path.clone(),
|
options: if read_only {
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
storage.options = if read_only {
|
|
||||||
vec!["ro".to_string()]
|
vec!["ro".to_string()]
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut device_id = String::new();
|
let mut device_id = String::new();
|
||||||
@@ -126,6 +118,12 @@ impl SPDKVolume {
|
|||||||
device_id = device.device_id;
|
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" {
|
if m.r#type != "bind" {
|
||||||
storage.fs_type = v.fs_type.clone();
|
storage.fs_type = v.fs_type.clone();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -97,7 +97,7 @@ impl VolumeResource {
|
|||||||
)
|
)
|
||||||
} else if is_spdk_volume(m) {
|
} else if is_spdk_volume(m) {
|
||||||
Arc::new(
|
Arc::new(
|
||||||
SPDKVolume::new(d, m, read_only, cid, sid)
|
SPDKVolume::new(d, m, read_only, sid)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("create spdk volume {:?}", m))?,
|
.with_context(|| format!("create spdk volume {:?}", m))?,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user