mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-20 00:07:55 +00:00
runtime-rs: fix the issue of missing create sandbox dir
It's needed to make sure the sandbox storage path exist before return it. Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
This commit is contained in:
@@ -73,8 +73,11 @@ fn get_uds_with_sid(short_id: &str, path: &str) -> Result<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return sandbox's storage path
|
// return sandbox's storage path
|
||||||
pub fn sb_storage_path() -> String {
|
pub fn sb_storage_path() -> Result<&'static str> {
|
||||||
String::from(KATA_PATH)
|
//make sure the path existed
|
||||||
|
std::fs::create_dir_all(KATA_PATH).context(format!("failed to create dir: {}", KATA_PATH))?;
|
||||||
|
|
||||||
|
Ok(KATA_PATH)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the address of the unix domain socket(UDS) for communication with shim
|
// returns the address of the unix domain socket(UDS) for communication with shim
|
||||||
@@ -87,7 +90,7 @@ pub fn mgmt_socket_addr(sid: &str) -> Result<String> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
get_uds_with_sid(sid, &sb_storage_path())
|
get_uds_with_sid(sid, &sb_storage_path()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Reference in New Issue
Block a user