Skip to content

Commit 6e0a9d0

Browse files
committed
wip
1 parent 30fce67 commit 6e0a9d0

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

crates/lib/src/cli.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,13 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
935935
} else {
936936
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
937937
let imgstore = sysroot.get_ensure_imgstore()?;
938-
let use_unified = imgstore
939-
.exists(&format!("{imgref:#}"))
940-
.await
941-
.unwrap_or(false);
938+
let use_unified = match imgstore.exists(&format!("{imgref:#}")).await {
939+
Ok(v) => v,
940+
Err(e) => {
941+
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
942+
false
943+
}
944+
};
942945

943946
let fetched = if use_unified {
944947
crate::deploy::pull_unified(repo, imgref, None, opts.quiet, prog.clone(), sysroot)
@@ -1075,10 +1078,13 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
10751078

10761079
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
10771080
let imgstore = sysroot.get_ensure_imgstore()?;
1078-
let use_unified = imgstore
1079-
.exists(&format!("{target:#}"))
1080-
.await
1081-
.unwrap_or(false);
1081+
let use_unified = match imgstore.exists(&format!("{target:#}")).await {
1082+
Ok(v) => v,
1083+
Err(e) => {
1084+
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
1085+
false
1086+
}
1087+
};
10821088

10831089
let fetched = if use_unified {
10841090
crate::deploy::pull_unified(repo, &target, None, opts.quiet, prog.clone(), sysroot).await?

crates/lib/src/deploy.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,13 @@ pub(crate) async fn pull_unified(
481481
Ok(existing)
482482
}
483483
PreparedPullResult::Ready(prepared_image_meta) => {
484-
pull_from_prepared(imgref, quiet, prog, *prepared_image_meta).await
484+
// To avoid duplicate success logs, pass a containers-storage imgref to the importer
485+
let cs_imgref = ImageReference {
486+
transport: "containers-storage".to_string(),
487+
image: imgref.image.clone(),
488+
signature: imgref.signature.clone(),
489+
};
490+
pull_from_prepared(&cs_imgref, quiet, prog, *prepared_image_meta).await
485491
}
486492
}
487493
}
@@ -598,6 +604,9 @@ pub(crate) async fn pull(
598604
}
599605
}
600606

607+
/// Pull selecting unified vs standard path based on persistent storage config.
608+
// pull_auto was reverted per request; keep explicit callers branching.
609+
601610
pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
602611
tokio::task::spawn_blocking(move || {
603612
sysroot

crates/lib/src/image.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ pub(crate) async fn set_unified_entrypoint() -> Result<()> {
207207
// Pull the image from its original source into bootc storage using LBI machinery
208208
let imgstore = sysroot.get_ensure_imgstore()?;
209209
let img_string = format!("{:#}", imgref);
210-
println!(
210+
const SET_UNIFIED_JOURNAL_ID: &str = "1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d";
211+
tracing::info!(
212+
message_id = SET_UNIFIED_JOURNAL_ID,
213+
bootc.image.reference = &imgref_display.image,
214+
bootc.image.transport = &imgref_display.transport,
211215
"Re-pulling booted image into bootc storage via unified path: {}",
212216
imgref_display
213217
);
@@ -226,6 +230,10 @@ pub(crate) async fn set_unified_entrypoint() -> Result<()> {
226230
let _ = ostree_ext::container::store::ImageImporter::new(repo, &ostree_imgref, Default::default())
227231
.await?;
228232

229-
println!("Unified storage set for current image. Future upgrade/switch will use it automatically.");
233+
tracing::info!(
234+
message_id = SET_UNIFIED_JOURNAL_ID,
235+
bootc.status = "set_unified_complete",
236+
"Unified storage set for current image. Future upgrade/switch will use it automatically."
237+
);
230238
Ok(())
231239
}

0 commit comments

Comments
 (0)