runtime-rs: agent: add shared field to Storage struct

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<Storage> 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 <ffidencio@nvidia.com>
Assisted-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fabiano Fidêncio
2026-05-08 15:35:08 +02:00
parent 00d4ee2344
commit 0b1e103886
7 changed files with 7 additions and 0 deletions

View File

@@ -114,6 +114,7 @@ impl From<Storage> 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()
}
}

View File

@@ -60,6 +60,7 @@ pub struct Storage {
pub fs_group: Option<FSGroup>,
pub options: Vec<String>,
pub mount_point: String,
pub shared: bool,
}
#[derive(PartialEq, Clone, Default)]

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -67,6 +67,7 @@ impl EphemeralVolume {
fs_group: None,
options: dir_options,
mount_point: source.clone(),
shared: false,
};
let mut mount = oci::Mount::default();

View File

@@ -75,6 +75,7 @@ impl LocalStorage {
fs_group: None,
options: dir_options,
mount_point: source.clone(),
shared: false,
};
let mounts: Vec<oci::Mount> = if sid != cid {