Skip to content

Commit fbe1949

Browse files
committed
composefs: Auto-detect unified storage from booted system
When a user has previously opted into unified storage, all subsequent switch and upgrade operations should continue using that path. Previously only the target image was checked; this also checks the booted image, so that switching to a new image while already on unified storage automatically stays on the unified path without requiring an explicit flag. Assisted-by: OpenCode (Claude Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 2b66ad4 commit fbe1949

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

crates/lib/src/bootc_composefs/switch.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,22 @@ pub(crate) async fn switch_composefs(
5252
let repo = &*booted_cfs.repo;
5353
let (image, img_config) = is_image_pulled(repo, &target_imgref).await?;
5454

55-
// Use unified storage if explicitly requested, or auto-detect if the
56-
// target image is already in bootc-owned containers-storage.
55+
// Use unified storage if explicitly requested, or auto-detect: either the
56+
// target image is already in bootc-owned containers-storage, OR the booted
57+
// image is — which means the user has opted into unified storage and all
58+
// subsequent operations (including switch to a new image) should use it.
5759
let use_unified = if opts.unified_storage_exp {
5860
true
5961
} else {
60-
crate::deploy::image_exists_in_unified_storage(storage, &target_imgref).await?
62+
let booted_imgref = host.spec.image.as_ref();
63+
let booted_unified = if let Some(booted) = booted_imgref {
64+
crate::deploy::image_exists_in_unified_storage(storage, booted).await?
65+
} else {
66+
false
67+
};
68+
let target_unified =
69+
crate::deploy::image_exists_in_unified_storage(storage, &target_imgref).await?;
70+
booted_unified || target_unified
6171
};
6272

6373
let do_upgrade_opts = DoUpgradeOpts {

0 commit comments

Comments
 (0)