MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / prepare_runtime_images

Method prepare_runtime_images

crates/openshell-driver-vm/src/driver.rs:1688–1717  ·  view source on GitHub ↗
(
        &self,
        sandbox_id: &str,
        image_ref: &str,
    )

Source from the content-addressed store, hash-verified

1686 }
1687
1688 async fn prepare_runtime_images(
1689 &self,
1690 sandbox_id: &str,
1691 image_ref: &str,
1692 ) -> Result<RuntimeImagePlan, Status> {
1693 let bootstrap_image_ref = self.bootstrap_image_ref(image_ref);
1694 let bootstrap_image_identity = self
1695 .ensure_cached_bootstrap_rootfs_image(sandbox_id, &bootstrap_image_ref)
1696 .await?;
1697 let root_disk = image_cache_rootfs_image(&self.config.state_dir, &bootstrap_image_identity);
1698
1699 if image_ref.trim() == bootstrap_image_ref.trim() {
1700 return Ok(RuntimeImagePlan {
1701 root_disk,
1702 image_disk: None,
1703 image_identity: bootstrap_image_identity.clone(),
1704 bootstrap_image_identity,
1705 });
1706 }
1707
1708 let prepared = self
1709 .ensure_prepared_image_disk(sandbox_id, image_ref, &root_disk)
1710 .await?;
1711 Ok(RuntimeImagePlan {
1712 root_disk,
1713 image_disk: Some(prepared.disk_path),
1714 image_identity: prepared.image_identity,
1715 bootstrap_image_identity,
1716 })
1717 }
1718
1719 fn bootstrap_image_ref(&self, sandbox_image_ref: &str) -> String {
1720 let configured = self.config.bootstrap_image.trim();

Callers 1

Tested by

no test coverage detected