@@ -304,10 +304,11 @@ async fn handle_layer_progress_print(
304304/// Gather all bound images in all deployments, then prune the image store,
305305/// using the gathered images as the roots (that will not be GC'd).
306306pub ( crate ) async fn prune_container_store ( sysroot : & Storage ) -> Result < ( ) > {
307- let deployments = sysroot. deployments ( ) ;
307+ let ostree = sysroot. get_ostree ( ) ?;
308+ let deployments = ostree. deployments ( ) ;
308309 let mut all_bound_images = Vec :: new ( ) ;
309310 for deployment in deployments {
310- let bound = crate :: boundimage:: query_bound_images_for_deployment ( sysroot , & deployment) ?;
311+ let bound = crate :: boundimage:: query_bound_images_for_deployment ( ostree , & deployment) ?;
311312 all_bound_images. extend ( bound. into_iter ( ) ) ;
312313 }
313314 // Convert to a hashset of just the image names
@@ -463,11 +464,11 @@ pub(crate) async fn cleanup(sysroot: &Storage) -> Result<()> {
463464 let bound_prune = prune_container_store ( sysroot) ;
464465
465466 // We create clones (just atomic reference bumps) here to move to the thread.
466- let repo = sysroot. repo ( ) ;
467- let sysroot = sysroot . get_ostree_cloned ( ) ? ;
467+ let ostree = sysroot. get_ostree_cloned ( ) ? ;
468+ let repo = ostree . repo ( ) ;
468469 let repo_prune =
469470 ostree_ext:: tokio_util:: spawn_blocking_cancellable_flatten ( move |cancellable| {
470- let locked_sysroot = & SysrootLock :: from_assumed_locked ( & sysroot ) ;
471+ let locked_sysroot = & SysrootLock :: from_assumed_locked ( & ostree ) ;
471472 let cancellable = Some ( cancellable) ;
472473 let repo = & repo;
473474 let txn = repo. auto_transaction ( cancellable) ?;
@@ -488,7 +489,7 @@ pub(crate) async fn cleanup(sysroot: &Storage) -> Result<()> {
488489
489490 // Then, for each deployment which is derived (e.g. has configmaps) we synthesize
490491 // a base ref to ensure that it's not GC'd.
491- for ( i, deployment) in sysroot . deployments ( ) . into_iter ( ) . enumerate ( ) {
492+ for ( i, deployment) in ostree . deployments ( ) . into_iter ( ) . enumerate ( ) {
492493 let commit = deployment. csum ( ) ;
493494 if let Some ( base) = get_base_commit ( repo, & commit) ? {
494495 repo. transaction_set_refspec ( & format ! ( "{BASE_IMAGE_PREFIX}/{i}" ) , Some ( & base) ) ;
@@ -582,7 +583,8 @@ async fn deploy(
582583 )
583584 . await ?;
584585 // SAFETY: We must have a staged deployment
585- let staged = sysroot. staged_deployment ( ) . unwrap ( ) ;
586+ let ostree = sysroot. get_ostree ( ) ?;
587+ let staged = ostree. staged_deployment ( ) . unwrap ( ) ;
586588 assert_eq ! ( staged. index( ) , r) ;
587589 Ok ( staged)
588590}
@@ -608,6 +610,7 @@ pub(crate) async fn stage(
608610 spec : & RequiredHostSpec < ' _ > ,
609611 prog : ProgressWriter ,
610612) -> Result < ( ) > {
613+ let ostree = sysroot. get_ostree ( ) ?;
611614 let mut subtask = SubTaskStep {
612615 subtask : "merging" . into ( ) ,
613616 description : "Merging Image" . into ( ) ,
@@ -629,7 +632,7 @@ pub(crate) async fn stage(
629632 . collect ( ) ,
630633 } )
631634 . await ;
632- let merge_deployment = sysroot . merge_deployment ( Some ( stateroot) ) ;
635+ let merge_deployment = ostree . merge_deployment ( Some ( stateroot) ) ;
633636
634637 subtask. completed = true ;
635638 subtasks. push ( subtask. clone ( ) ) ;
@@ -740,15 +743,18 @@ pub(crate) async fn stage(
740743/// Implementation of rollback functionality
741744pub ( crate ) async fn rollback ( sysroot : & Storage ) -> Result < ( ) > {
742745 const ROLLBACK_JOURNAL_ID : & str = "26f3b1eb24464d12aa5e7b544a6b5468" ;
743- let repo = & sysroot. repo ( ) ;
744- let ( booted_deployment, deployments, host) = crate :: status:: get_status_require_booted ( sysroot ) ?;
746+ let ostree = sysroot. get_ostree ( ) ? ;
747+ let ( booted_deployment, deployments, host) = crate :: status:: get_status_require_booted ( ostree ) ?;
745748
746749 let new_spec = {
747750 let mut new_spec = host. spec . clone ( ) ;
748751 new_spec. boot_order = new_spec. boot_order . swap ( ) ;
749752 new_spec
750753 } ;
751754
755+ let ostree = sysroot. get_ostree ( ) ?;
756+ let repo = & ostree. repo ( ) ;
757+
752758 // Just to be sure
753759 host. spec . verify_transition ( & new_spec) ?;
754760
@@ -788,7 +794,7 @@ pub(crate) async fn rollback(sysroot: &Storage) -> Result<()> {
788794 . chain ( deployments. other )
789795 . collect :: < Vec < _ > > ( ) ;
790796 tracing:: debug!( "Writing new deployments: {new_deployments:?}" ) ;
791- sysroot . write_deployments ( & new_deployments, gio:: Cancellable :: NONE ) ?;
797+ ostree . write_deployments ( & new_deployments, gio:: Cancellable :: NONE ) ?;
792798 if reverting {
793799 println ! ( "Next boot: current deployment" ) ;
794800 } else {
0 commit comments