diff --git a/src/runtime-rs/crates/resource/src/volume/direct_volumes/spdk_volume.rs b/src/runtime-rs/crates/resource/src/volume/direct_volumes/spdk_volume.rs index f63fd33abf..0e66918ca6 100644 --- a/src/runtime-rs/crates/resource/src/volume/direct_volumes/spdk_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/direct_volumes/spdk_volume.rs @@ -36,7 +36,6 @@ impl SPDKVolume { d: &RwLock, m: &oci::Mount, read_only: bool, - cid: &str, sid: &str, ) -> Result { 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 { diff --git a/src/runtime-rs/crates/resource/src/volume/mod.rs b/src/runtime-rs/crates/resource/src/volume/mod.rs index cdae44d6e3..156fc535c7 100644 --- a/src/runtime-rs/crates/resource/src/volume/mod.rs +++ b/src/runtime-rs/crates/resource/src/volume/mod.rs @@ -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))?, )