Skip to content

Commit aaf09ee

Browse files
committed
install: Change to access c_storage via overall Storage
It's just way too confusing we have two structs called `Storage`. I'm going to rename one of them after this. But as prep for that, switch to dynamically initialzing the containers-storage version from the main Storage. Signed-off-by: Colin Walters <[email protected]>
1 parent 4d540c8 commit aaf09ee

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

crates/lib/src/install.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,7 @@ pub(crate) fn print_configuration() -> Result<()> {
630630
}
631631

632632
#[context("Creating ostree deployment")]
633-
async fn initialize_ostree_root(
634-
state: &State,
635-
root_setup: &RootSetup,
636-
) -> Result<(Storage, bool, crate::imgstorage::Storage)> {
633+
async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result<(Storage, bool)> {
637634
let sepolicy = state.load_policy()?;
638635
let sepolicy = sepolicy.as_ref();
639636
// Load a fd for the mounted target physical root
@@ -727,11 +724,11 @@ async fn initialize_ostree_root(
727724
)?;
728725
}
729726

730-
let imgstore = crate::imgstorage::Storage::create(&sysroot_dir, &temp_run, sepolicy)?;
731-
732727
sysroot.load(cancellable)?;
733728
let sysroot = SysrootLock::new_from_sysroot(&sysroot).await?;
734-
Ok((Storage::new(sysroot, &temp_run)?, has_ostree, imgstore))
729+
let storage = Storage::new(sysroot, &temp_run)?;
730+
731+
Ok((storage, has_ostree))
735732
}
736733

737734
fn check_disk_space(
@@ -1336,13 +1333,14 @@ async fn prepare_install(
13361333
async fn install_with_sysroot(
13371334
state: &State,
13381335
rootfs: &RootSetup,
1339-
sysroot: &Storage,
1336+
storage: &Storage,
13401337
boot_uuid: &str,
13411338
bound_images: BoundImages,
13421339
has_ostree: bool,
1343-
imgstore: &crate::imgstorage::Storage,
13441340
) -> Result<()> {
1345-
let ostree = sysroot.get_ostree()?;
1341+
let ostree = storage.get_ostree()?;
1342+
let c_storage = storage.get_ensure_imgstore()?;
1343+
13461344
// And actually set up the container in that root, returning a deployment and
13471345
// the aleph state (see below).
13481346
let (deployment, aleph) = install_container(state, rootfs, ostree, has_ostree).await?;
@@ -1377,11 +1375,11 @@ async fn install_with_sysroot(
13771375
// Now copy each bound image from the host's container storage into the target.
13781376
for image in resolved_bound_images {
13791377
let image = image.image.as_str();
1380-
imgstore.pull_from_host_storage(image).await?;
1378+
c_storage.pull_from_host_storage(image).await?;
13811379
}
13821380
}
13831381
BoundImages::Unresolved(bound_images) => {
1384-
crate::boundimage::pull_images_impl(imgstore, bound_images)
1382+
crate::boundimage::pull_images_impl(c_storage, bound_images)
13851383
.await
13861384
.context("pulling bound images")?;
13871385
}
@@ -1461,7 +1459,7 @@ async fn install_to_filesystem_impl(
14611459
// Initialize the ostree sysroot (repo, stateroot, etc.)
14621460

14631461
{
1464-
let (sysroot, has_ostree, imgstore) = initialize_ostree_root(state, rootfs).await?;
1462+
let (sysroot, has_ostree) = initialize_ostree_root(state, rootfs).await?;
14651463

14661464
install_with_sysroot(
14671465
state,
@@ -1470,7 +1468,6 @@ async fn install_to_filesystem_impl(
14701468
&boot_uuid,
14711469
bound_images,
14721470
has_ostree,
1473-
&imgstore,
14741471
)
14751472
.await?;
14761473
let ostree = sysroot.get_ostree()?;

0 commit comments

Comments
 (0)