Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmm: fix tmpfs bind dir empty #138

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion vmm/sandbox/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ where
// handle tmpfs mount
let mount_info = get_mount_info(&m.source).await?;
if let Some(mi) = mount_info {
if mi.fs_type == "tmpfs" {
// Only allow use tmpfs in emptyDir
if mi.fs_type == "tmpfs" && mi.mount_point.contains("kubernetes.io~empty-dir") {
self.handle_tmpfs_mount(&id, container_id, m, &mi).await?;
return Ok(());
}
Expand Down Expand Up @@ -317,6 +318,7 @@ where
}

pub struct MountInfo {
pub mount_point: String,
pub fs_type: String,
pub options: Vec<String>,
}
6 changes: 5 additions & 1 deletion vmm/sandbox/src/storage/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ pub async fn get_mount_info(mount_point: &str) -> Result<Option<MountInfo>> {
if mp == mount_point {
let fs_type = fields[2].to_string();
let options = fields[3].split(',').map(|x| x.to_string()).collect();
return Ok(Some(MountInfo { fs_type, options }));
return Ok(Some(MountInfo {
mount_point: mp,
fs_type,
options,
}));
}
}
Ok(None)
Expand Down
Loading