@@ -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,38 @@ 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 PULL_JOURNAL_ID : & str = "5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9" ;
465
+ let msg = format ! ( "Image already present: {}" , imgref) ;
466
+ crate :: journal:: journal_send (
467
+ Priority :: Debug ,
468
+ & msg,
469
+ [
470
+ ( "MESSAGE_ID" , PULL_JOURNAL_ID ) ,
471
+ ( "BOOTC_IMAGE_REFERENCE" , & imgref. image ) ,
472
+ ( "BOOTC_IMAGE_TRANSPORT" , & imgref. transport ) ,
473
+ ( "BOOTC_STATUS" , "already_present" ) ,
474
+ ]
475
+ . into_iter ( ) ,
476
+ ) ;
477
+ Ok ( existing)
478
+ }
446
479
PreparedPullResult :: Ready ( prepared_image_meta) => {
480
+ // Log that we're pulling a new image
481
+ const PULL_JOURNAL_ID : & str = "5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9" ;
482
+ let msg = format ! ( "Pulling new image: {}" , imgref) ;
483
+ crate :: journal:: journal_send (
484
+ Priority :: Info ,
485
+ & msg,
486
+ [
487
+ ( "MESSAGE_ID" , PULL_JOURNAL_ID ) ,
488
+ ( "BOOTC_IMAGE_REFERENCE" , & imgref. image ) ,
489
+ ( "BOOTC_IMAGE_TRANSPORT" , & imgref. transport ) ,
490
+ ( "BOOTC_STATUS" , "pulling_new" ) ,
491
+ ]
492
+ . into_iter ( ) ,
493
+ ) ;
447
494
Ok ( pull_from_prepared ( imgref, quiet, prog, prepared_image_meta) . await ?)
448
495
}
449
496
}
@@ -461,6 +508,15 @@ pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
461
508
}
462
509
463
510
pub ( crate ) async fn cleanup ( sysroot : & Storage ) -> Result < ( ) > {
511
+ // Log the cleanup operation to systemd journal
512
+ const CLEANUP_JOURNAL_ID : & str = "2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6" ;
513
+ let msg = "Starting cleanup of old images and deployments" ;
514
+ crate :: journal:: journal_send (
515
+ Priority :: Info ,
516
+ msg,
517
+ [ ( "MESSAGE_ID" , CLEANUP_JOURNAL_ID ) ] . into_iter ( ) ,
518
+ ) ;
519
+
464
520
let bound_prune = prune_container_store ( sysroot) ;
465
521
466
522
// We create clones (just atomic reference bumps) here to move to the thread.
@@ -610,6 +666,25 @@ pub(crate) async fn stage(
610
666
spec : & RequiredHostSpec < ' _ > ,
611
667
prog : ProgressWriter ,
612
668
) -> Result < ( ) > {
669
+ // Log the staging operation to systemd journal with comprehensive upgrade information
670
+ const STAGE_JOURNAL_ID : & str = "8f7a2b1c3d4e5f6a7b8c9d0e1f2a3b4c" ;
671
+ let msg = format ! (
672
+ "Staging image for deployment: {} (digest: {})" ,
673
+ spec. image, image. manifest_digest
674
+ ) ;
675
+ crate :: journal:: journal_send (
676
+ Priority :: Info ,
677
+ & msg,
678
+ [
679
+ ( "MESSAGE_ID" , STAGE_JOURNAL_ID ) ,
680
+ ( "BOOTC_IMAGE_REFERENCE" , & spec. image . image ) ,
681
+ ( "BOOTC_IMAGE_TRANSPORT" , & spec. image . transport ) ,
682
+ ( "BOOTC_MANIFEST_DIGEST" , image. manifest_digest . as_ref ( ) ) ,
683
+ ( "BOOTC_STATEROOT" , stateroot) ,
684
+ ]
685
+ . into_iter ( ) ,
686
+ ) ;
687
+
613
688
let ostree = sysroot. get_ostree ( ) ?;
614
689
let mut subtask = SubTaskStep {
615
690
subtask : "merging" . into ( ) ,
@@ -768,19 +843,39 @@ pub(crate) async fn rollback(sysroot: &Storage) -> Result<()> {
768
843
let rollback_image = rollback_status
769
844
. query_image ( repo) ?
770
845
. ok_or_else ( || anyhow ! ( "Rollback is not container image based" ) ) ?;
846
+
847
+ // Get current booted image for comparison
848
+ let current_image = host
849
+ . status
850
+ . booted
851
+ . as_ref ( )
852
+ . and_then ( |b| b. query_image ( repo) . ok ( ) ?) ;
853
+
771
854
let msg = format ! ( "Rolling back to image: {}" , rollback_image. manifest_digest) ;
772
- libsystemd :: logging :: journal_send (
773
- libsystemd :: logging :: Priority :: Info ,
855
+ crate :: journal :: journal_send (
856
+ Priority :: Info ,
774
857
& msg,
775
858
[
776
859
( "MESSAGE_ID" , ROLLBACK_JOURNAL_ID ) ,
777
860
(
778
861
"BOOTC_MANIFEST_DIGEST" ,
779
862
rollback_image. manifest_digest . as_ref ( ) ,
780
863
) ,
864
+ ( "BOOTC_OSTREE_COMMIT" , & rollback_image. merge_commit ) ,
865
+ (
866
+ "BOOTC_ROLLBACK_TYPE" ,
867
+ if reverting { "revert" } else { "rollback" } ,
868
+ ) ,
869
+ (
870
+ "BOOTC_CURRENT_MANIFEST_DIGEST" ,
871
+ current_image
872
+ . as_ref ( )
873
+ . map ( |i| i. manifest_digest . as_ref ( ) )
874
+ . unwrap_or ( "none" ) ,
875
+ ) ,
781
876
]
782
877
. into_iter ( ) ,
783
- ) ? ;
878
+ ) ;
784
879
// SAFETY: If there's a rollback status, then there's a deployment
785
880
let rollback_deployment = deployments. rollback . expect ( "rollback deployment" ) ;
786
881
let new_deployments = if reverting {
@@ -828,6 +923,21 @@ fn find_newest_deployment_name(deploysdir: &Dir) -> Result<String> {
828
923
829
924
// Implementation of `bootc switch --in-place`
830
925
pub ( crate ) fn switch_origin_inplace ( root : & Dir , imgref : & ImageReference ) -> Result < String > {
926
+ // Log the in-place switch operation to systemd journal
927
+ const SWITCH_INPLACE_JOURNAL_ID : & str = "3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7" ;
928
+ let msg = format ! ( "Performing in-place switch to image: {}" , imgref) ;
929
+ crate :: journal:: journal_send (
930
+ Priority :: Info ,
931
+ & msg,
932
+ [
933
+ ( "MESSAGE_ID" , SWITCH_INPLACE_JOURNAL_ID ) ,
934
+ ( "BOOTC_IMAGE_REFERENCE" , & imgref. image ) ,
935
+ ( "BOOTC_IMAGE_TRANSPORT" , & imgref. transport ) ,
936
+ ( "BOOTC_SWITCH_TYPE" , "in_place" ) ,
937
+ ]
938
+ . into_iter ( ) ,
939
+ ) ;
940
+
831
941
// First, just create the new origin file
832
942
let origin = origin_from_imageref ( imgref) ?;
833
943
let serialized_origin = origin. to_data ( ) ;
0 commit comments