From 0b1e103886deb8df4a90473cb57e413e159743ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 8 May 2026 15:35:08 +0200 Subject: [PATCH] runtime-rs: agent: add shared field to Storage struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proto Storage message already has a "shared" field (field 8), but the runtime-rs agent crate's internal Storage struct was missing it, so it was never forwarded to the kata-agent. Add the field to the Rust struct and its From translation, and update all explicit struct initialisers across the resource crate to include shared: false so the build stays clean. This is needed for trusted ephemeral data storage, where the agent uses the shared flag to avoid premature cleanup of volumes that are shared across containers in a pod. Signed-off-by: Fabiano FidĂȘncio Assisted-by: Cursor --- src/runtime-rs/crates/agent/src/kata/trans.rs | 1 + src/runtime-rs/crates/agent/src/types.rs | 1 + .../crates/resource/src/share_fs/share_virtio_fs_inline.rs | 1 + .../crates/resource/src/share_fs/share_virtio_fs_standalone.rs | 1 + .../crates/resource/src/share_fs/virtio_fs_share_mount.rs | 1 + src/runtime-rs/crates/resource/src/volume/ephemeral_volume.rs | 1 + src/runtime-rs/crates/resource/src/volume/local_volume.rs | 1 + 7 files changed, 7 insertions(+) diff --git a/src/runtime-rs/crates/agent/src/kata/trans.rs b/src/runtime-rs/crates/agent/src/kata/trans.rs index eec571a558..fba1f1954c 100644 --- a/src/runtime-rs/crates/agent/src/kata/trans.rs +++ b/src/runtime-rs/crates/agent/src/kata/trans.rs @@ -114,6 +114,7 @@ impl From for agent::Storage { fs_group: from_option(from.fs_group), options: trans_vec(from.options), mount_point: from.mount_point, + shared: from.shared, ..Default::default() } } diff --git a/src/runtime-rs/crates/agent/src/types.rs b/src/runtime-rs/crates/agent/src/types.rs index 8e0917b559..2352799c02 100644 --- a/src/runtime-rs/crates/agent/src/types.rs +++ b/src/runtime-rs/crates/agent/src/types.rs @@ -60,6 +60,7 @@ pub struct Storage { pub fs_group: Option, pub options: Vec, pub mount_point: String, + pub shared: bool, } #[derive(PartialEq, Clone, Default)] diff --git a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_inline.rs b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_inline.rs index a5d97503af..bf4d00d2e3 100644 --- a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_inline.rs +++ b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_inline.rs @@ -89,6 +89,7 @@ impl ShareFs for ShareVirtioFsInline { fs_group: None, options: SHARED_DIR_VIRTIO_FS_OPTIONS.clone(), mount_point: kata_guest_share_dir(), + shared: false, }; storages.push(shared_volume); diff --git a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs index 2e181b75af..8e8cbd5b6d 100644 --- a/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs +++ b/src/runtime-rs/crates/resource/src/share_fs/share_virtio_fs_standalone.rs @@ -246,6 +246,7 @@ impl ShareFs for ShareVirtioFsStandalone { fs_group: None, options: vec![String::from("nodev")], mount_point: kata_guest_share_dir(), + shared: false, }; storages.push(shared_volume); diff --git a/src/runtime-rs/crates/resource/src/share_fs/virtio_fs_share_mount.rs b/src/runtime-rs/crates/resource/src/share_fs/virtio_fs_share_mount.rs index 18415c0aeb..61b5eb6d28 100644 --- a/src/runtime-rs/crates/resource/src/share_fs/virtio_fs_share_mount.rs +++ b/src/runtime-rs/crates/resource/src/share_fs/virtio_fs_share_mount.rs @@ -108,6 +108,7 @@ impl ShareFsMount for VirtiofsShareMount { fs_group: None, options: config.mount_options.clone(), mount_point: watchable_guest_mount.clone(), + shared: false, }; // Update the guest_path, in order to identify what will diff --git a/src/runtime-rs/crates/resource/src/volume/ephemeral_volume.rs b/src/runtime-rs/crates/resource/src/volume/ephemeral_volume.rs index c8c794edcf..3c3861294b 100644 --- a/src/runtime-rs/crates/resource/src/volume/ephemeral_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/ephemeral_volume.rs @@ -67,6 +67,7 @@ impl EphemeralVolume { fs_group: None, options: dir_options, mount_point: source.clone(), + shared: false, }; let mut mount = oci::Mount::default(); diff --git a/src/runtime-rs/crates/resource/src/volume/local_volume.rs b/src/runtime-rs/crates/resource/src/volume/local_volume.rs index 6b82a51fdc..d0f33d8428 100644 --- a/src/runtime-rs/crates/resource/src/volume/local_volume.rs +++ b/src/runtime-rs/crates/resource/src/volume/local_volume.rs @@ -75,6 +75,7 @@ impl LocalStorage { fs_group: None, options: dir_options, mount_point: source.clone(), + shared: false, }; let mounts: Vec = if sid != cid {