mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-10 05:44:04 +00:00
Merge pull request #8620 from Apokleos/enhance-directv-using-csi
runtime-rs: Enhancement of DirectVolume when using a dedicated CSI
This commit is contained in:
commit
c7c7632203
@ -94,14 +94,18 @@ impl Mount {
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct DirectVolumeMountInfo {
|
||||
/// The type of the volume (ie. block)
|
||||
#[serde(rename = "volume-type")]
|
||||
pub volume_type: String,
|
||||
/// The device backing the volume.
|
||||
pub device: String,
|
||||
/// The filesystem type to be mounted on the volume.
|
||||
#[serde(rename = "fstype")]
|
||||
pub fs_type: String,
|
||||
/// Additional metadata to pass to the agent regarding this volume.
|
||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||
pub metadata: HashMap<String, String>,
|
||||
/// Additional mount options.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub options: Vec<String>,
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
|
||||
use kata_types::mount::{
|
||||
get_volume_mount_info, join_path, DirectVolumeMountInfo, KATA_DIRECT_VOLUME_ROOT_PATH,
|
||||
@ -28,5 +28,12 @@ pub fn get_direct_volume_path(volume_path: &str) -> Result<String> {
|
||||
let volume_full_path =
|
||||
join_path(KATA_DIRECT_VOLUME_ROOT_PATH, volume_path).context("failed to join path.")?;
|
||||
|
||||
Ok(volume_full_path.display().to_string())
|
||||
if volume_full_path.exists() {
|
||||
Ok(volume_full_path.display().to_string())
|
||||
} else {
|
||||
Err(anyhow!(format!(
|
||||
"direct volume path {:?} Not Found",
|
||||
&volume_full_path
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user