@@ -11,6 +11,7 @@ use cap_std::fs::{Dir, MetadataExt};
11
11
use cap_std_ext:: cap_std;
12
12
use cap_std_ext:: dirext:: CapStdExtDirExt ;
13
13
use fn_error_context:: context;
14
+ use libsystemd:: logging:: Priority ;
14
15
use ostree:: { gio, glib} ;
15
16
use ostree_container:: OstreeImageReference ;
16
17
use ostree_ext:: container as ostree_container;
@@ -99,7 +100,7 @@ pub(crate) fn check_bootc_label(config: &ostree_ext::oci_spec::image::ImageConfi
99
100
match label. as_str ( ) {
100
101
crate :: metadata:: COMPAT_LABEL_V1 => { }
101
102
o => crate :: journal:: journal_print (
102
- libsystemd :: logging :: Priority :: Warning ,
103
+ Priority :: Warning ,
103
104
& format ! (
104
105
"notice: Unknown {} value {}" ,
105
106
crate :: metadata:: BOOTC_COMPAT_LABEL ,
@@ -109,7 +110,7 @@ pub(crate) fn check_bootc_label(config: &ostree_ext::oci_spec::image::ImageConfi
109
110
}
110
111
} else {
111
112
crate :: journal:: journal_print (
112
- libsystemd :: logging :: Priority :: Warning ,
113
+ Priority :: Warning ,
113
114
& format ! (
114
115
"notice: Image is missing label: {}" ,
115
116
crate :: metadata:: BOOTC_COMPAT_LABEL
@@ -424,11 +425,27 @@ pub(crate) async fn pull_from_prepared(
424
425
let imgref_canonicalized = imgref. clone ( ) . canonicalize ( ) ?;
425
426
tracing:: debug!( "Canonicalized image reference: {imgref_canonicalized:#}" ) ;
426
427
428
+ // Log successful import completion
429
+ const IMPORT_COMPLETE_JOURNAL_ID : & str = "4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8" ;
430
+ let msg = format ! ( "Successfully imported image: {}" , imgref) ;
431
+ crate :: journal:: journal_send (
432
+ Priority :: Info ,
433
+ & msg,
434
+ [
435
+ ( "MESSAGE_ID" , IMPORT_COMPLETE_JOURNAL_ID ) ,
436
+ ( "BOOTC_IMAGE_REFERENCE" , & imgref. image ) ,
437
+ ( "BOOTC_IMAGE_TRANSPORT" , & imgref. transport ) ,
438
+ ( "BOOTC_MANIFEST_DIGEST" , import. manifest_digest . as_ref ( ) ) ,
439
+ ( "BOOTC_OSTREE_COMMIT" , & import. merge_commit ) ,
440
+ ]
441
+ . into_iter ( ) ,
442
+ ) ;
443
+
427
444
if let Some ( msg) =
428
445
ostree_container:: store:: image_filtered_content_warning ( & import. filtered_files )
429
446
. context ( "Image content warning" ) ?
430
447
{
431
- crate :: journal:: journal_print ( libsystemd :: logging :: Priority :: Notice , & msg) ;
448
+ crate :: journal:: journal_print ( Priority :: Notice , & msg) ;
432
449
}
433
450
Ok ( Box :: new ( ( * import) . into ( ) ) )
434
451
}
@@ -442,8 +459,30 @@ pub(crate) async fn pull(
442
459
prog : ProgressWriter ,
443
460
) -> Result < Box < ImageState > > {
444
461
match prepare_for_pull ( repo, imgref, target_imgref) . await ? {
445
- PreparedPullResult :: AlreadyPresent ( existing) => Ok ( existing) ,
462
+ PreparedPullResult :: AlreadyPresent ( existing) => {
463
+ // Log that the image was already present (Debug level since it's not actionable)
464
+ const IMAGE_ALREADY_PRESENT_ID : & str = "5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9" ;
465
+ tracing:: debug!(
466
+ message_id = IMAGE_ALREADY_PRESENT_ID ,
467
+ bootc. image. reference = & imgref. image,
468
+ bootc. image. transport = & imgref. transport,
469
+ bootc. status = "already_present" ,
470
+ "Image already present: {}" ,
471
+ imgref
472
+ ) ;
473
+ Ok ( existing)
474
+ }
446
475
PreparedPullResult :: Ready ( prepared_image_meta) => {
476
+ // Log that we're pulling a new image
477
+ const PULLING_NEW_IMAGE_ID : & str = "6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0" ;
478
+ tracing:: info!(
479
+ message_id = PULLING_NEW_IMAGE_ID ,
480
+ bootc. image. reference = & imgref. image,
481
+ bootc. image. transport = & imgref. transport,
482
+ bootc. status = "pulling_new" ,
483
+ "Pulling new image: {}" ,
484
+ imgref
485
+ ) ;
447
486
Ok ( pull_from_prepared ( imgref, quiet, prog, prepared_image_meta) . await ?)
448
487
}
449
488
}
@@ -461,6 +500,15 @@ pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
461
500
}
462
501
463
502
pub ( crate ) async fn cleanup ( sysroot : & Storage ) -> Result < ( ) > {
503
+ // Log the cleanup operation to systemd journal
504
+ const CLEANUP_JOURNAL_ID : & str = "2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6" ;
505
+ let msg = "Starting cleanup of old images and deployments" ;
506
+ crate :: journal:: journal_send (
507
+ Priority :: Info ,
508
+ msg,
509
+ [ ( "MESSAGE_ID" , CLEANUP_JOURNAL_ID ) ] . into_iter ( ) ,
510
+ ) ;
511
+
464
512
let bound_prune = prune_container_store ( sysroot) ;
465
513
466
514
// We create clones (just atomic reference bumps) here to move to the thread.
@@ -610,6 +658,25 @@ pub(crate) async fn stage(
610
658
spec : & RequiredHostSpec < ' _ > ,
611
659
prog : ProgressWriter ,
612
660
) -> Result < ( ) > {
661
+ // Log the staging operation to systemd journal with comprehensive upgrade information
662
+ const STAGE_JOURNAL_ID : & str = "8f7a2b1c3d4e5f6a7b8c9d0e1f2a3b4c" ;
663
+ let msg = format ! (
664
+ "Staging image for deployment: {} (digest: {})" ,
665
+ spec. image, image. manifest_digest
666
+ ) ;
667
+ crate :: journal:: journal_send (
668
+ Priority :: Info ,
669
+ & msg,
670
+ [
671
+ ( "MESSAGE_ID" , STAGE_JOURNAL_ID ) ,
672
+ ( "BOOTC_IMAGE_REFERENCE" , & spec. image . image ) ,
673
+ ( "BOOTC_IMAGE_TRANSPORT" , & spec. image . transport ) ,
674
+ ( "BOOTC_MANIFEST_DIGEST" , image. manifest_digest . as_ref ( ) ) ,
675
+ ( "BOOTC_STATEROOT" , stateroot) ,
676
+ ]
677
+ . into_iter ( ) ,
678
+ ) ;
679
+
613
680
let ostree = sysroot. get_ostree ( ) ?;
614
681
let mut subtask = SubTaskStep {
615
682
subtask : "merging" . into ( ) ,
@@ -768,19 +835,39 @@ pub(crate) async fn rollback(sysroot: &Storage) -> Result<()> {
768
835
let rollback_image = rollback_status
769
836
. query_image ( repo) ?
770
837
. ok_or_else ( || anyhow ! ( "Rollback is not container image based" ) ) ?;
838
+
839
+ // Get current booted image for comparison
840
+ let current_image = host
841
+ . status
842
+ . booted
843
+ . as_ref ( )
844
+ . and_then ( |b| b. query_image ( repo) . ok ( ) ?) ;
845
+
771
846
let msg = format ! ( "Rolling back to image: {}" , rollback_image. manifest_digest) ;
772
- libsystemd :: logging :: journal_send (
773
- libsystemd :: logging :: Priority :: Info ,
847
+ crate :: journal :: journal_send (
848
+ Priority :: Info ,
774
849
& msg,
775
850
[
776
851
( "MESSAGE_ID" , ROLLBACK_JOURNAL_ID ) ,
777
852
(
778
853
"BOOTC_MANIFEST_DIGEST" ,
779
854
rollback_image. manifest_digest . as_ref ( ) ,
780
855
) ,
856
+ ( "BOOTC_OSTREE_COMMIT" , & rollback_image. merge_commit ) ,
857
+ (
858
+ "BOOTC_ROLLBACK_TYPE" ,
859
+ if reverting { "revert" } else { "rollback" } ,
860
+ ) ,
861
+ (
862
+ "BOOTC_CURRENT_MANIFEST_DIGEST" ,
863
+ current_image
864
+ . as_ref ( )
865
+ . map ( |i| i. manifest_digest . as_ref ( ) )
866
+ . unwrap_or ( "none" ) ,
867
+ ) ,
781
868
]
782
869
. into_iter ( ) ,
783
- ) ? ;
870
+ ) ;
784
871
// SAFETY: If there's a rollback status, then there's a deployment
785
872
let rollback_deployment = deployments. rollback . expect ( "rollback deployment" ) ;
786
873
let new_deployments = if reverting {
@@ -828,6 +915,21 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
828
915
829
916
// Implementation of `bootc switch --in-place`
830
917
pub ( crate ) fn switch_origin_inplace ( root : & Dir , imgref : & ImageReference ) -> Result < String > {
918
+ // Log the in-place switch operation to systemd journal
919
+ const SWITCH_INPLACE_JOURNAL_ID : & str = "3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7" ;
920
+ let msg = format ! ( "Performing in-place switch to image: {}" , imgref) ;
921
+ crate :: journal:: journal_send (
922
+ Priority :: Info ,
923
+ & msg,
924
+ [
925
+ ( "MESSAGE_ID" , SWITCH_INPLACE_JOURNAL_ID ) ,
926
+ ( "BOOTC_IMAGE_REFERENCE" , & imgref. image ) ,
927
+ ( "BOOTC_IMAGE_TRANSPORT" , & imgref. transport ) ,
928
+ ( "BOOTC_SWITCH_TYPE" , "in_place" ) ,
929
+ ]
930
+ . into_iter ( ) ,
931
+ ) ;
932
+
831
933
// First, just create the new origin file
832
934
let origin = origin_from_imageref ( imgref) ?;
833
935
let serialized_origin = origin. to_data ( ) ;
0 commit comments