Skip to content

Commit f4243c7

Browse files
committed
fix(vm): scope rootfs cache by openshell version
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent a3ed421 commit f4243c7

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

crates/openshell-driver-vm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ Linux-owned ext4 storage. The resulting disk is cached under
180180
sandboxes. Local Docker images are still exported as rootfs tar archives and
181181
prepared inside the bootstrap VM. Set `OPENSHELL_VM_IMAGE_PULL_CONCURRENCY` to
182182
tune registry layer download parallelism (default `4`, maximum `16`).
183+
Both caches are scoped by source image identity and OpenShell version, so an
184+
OpenShell upgrade builds a fresh guest rootfs instead of reusing one with an old
185+
embedded supervisor.
183186
184187
Each sandbox gets its own sparse writable
185188
`<state-dir>/sandboxes/<id>/overlay.ext4`. Guest init mounts overlayfs as `/`

crates/openshell-driver-vm/src/driver.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ const GUEST_IMAGE_CONFIG_DIR: &str = "openshell-image";
111111
const GUEST_IMAGE_OCI_LAYOUT_DIR: &str = "oci";
112112
const GUEST_IMAGE_OCI_REF: &str = "openshell";
113113
const IMAGE_EXPORT_ROOTFS_ARCHIVE: &str = "source-rootfs.tar";
114-
const BOOTSTRAP_IMAGE_CACHE_LAYOUT_VERSION: &str = "sandbox-bootstrap-rootfs-ext4-v2";
115-
const PREPARED_IMAGE_CACHE_LAYOUT_VERSION: &str = "sandbox-prepared-rootfs-ext4-umoci-v2";
114+
const BOOTSTRAP_IMAGE_CACHE_LAYOUT_VERSION: &str = "sandbox-bootstrap-rootfs-ext4-v3";
115+
const PREPARED_IMAGE_CACHE_LAYOUT_VERSION: &str = "sandbox-prepared-rootfs-ext4-umoci-v3";
116116
const IMAGE_IDENTITY_FILE: &str = "image-identity";
117117
const IMAGE_REFERENCE_FILE: &str = "image-reference";
118118
const IMAGE_PREP_INIT_MODE: &str = "image-prep";
@@ -3725,11 +3725,17 @@ fn write_oci_layout_for_manifest(
37253725
}
37263726

37273727
fn bootstrap_image_cache_identity(image_identity: &str) -> String {
3728-
format!("{BOOTSTRAP_IMAGE_CACHE_LAYOUT_VERSION}:{image_identity}")
3728+
format!(
3729+
"{BOOTSTRAP_IMAGE_CACHE_LAYOUT_VERSION}:openshell-{}:{image_identity}",
3730+
openshell_core::VERSION
3731+
)
37293732
}
37303733

37313734
fn prepared_image_cache_identity(image_identity: &str) -> String {
3732-
format!("{PREPARED_IMAGE_CACHE_LAYOUT_VERSION}:{image_identity}")
3735+
format!(
3736+
"{PREPARED_IMAGE_CACHE_LAYOUT_VERSION}:openshell-{}:{image_identity}",
3737+
openshell_core::VERSION
3738+
)
37333739
}
37343740

37353741
fn registry_layer_download_concurrency() -> usize {
@@ -5517,18 +5523,24 @@ mod tests {
55175523
}
55185524

55195525
#[test]
5520-
fn prepared_image_cache_identity_includes_rootfs_layout_version() {
5526+
fn prepared_image_cache_identity_includes_rootfs_layout_and_openshell_version() {
55215527
assert_eq!(
55225528
prepared_image_cache_identity("sha256:local-image"),
5523-
"sandbox-prepared-rootfs-ext4-umoci-v2:sha256:local-image"
5529+
format!(
5530+
"sandbox-prepared-rootfs-ext4-umoci-v3:openshell-{}:sha256:local-image",
5531+
openshell_core::VERSION
5532+
)
55245533
);
55255534
}
55265535

55275536
#[test]
5528-
fn bootstrap_image_cache_identity_includes_rootfs_layout_version() {
5537+
fn bootstrap_image_cache_identity_includes_rootfs_layout_and_openshell_version() {
55295538
assert_eq!(
55305539
bootstrap_image_cache_identity("sha256:bootstrap-image"),
5531-
"sandbox-bootstrap-rootfs-ext4-v2:sha256:bootstrap-image"
5540+
format!(
5541+
"sandbox-bootstrap-rootfs-ext4-v3:openshell-{}:sha256:bootstrap-image",
5542+
openshell_core::VERSION
5543+
)
55325544
);
55335545
}
55345546

0 commit comments

Comments
 (0)