(
&self,
sandbox: Sandbox,
image_ref: String,
state_dir: PathBuf,
tls_paths: Option<VmDriverTlsPaths>,
overlay_preparation: OverlayPreparation,
)
| 669 | |
| 670 | #[allow(clippy::result_large_err)] |
| 671 | async fn provision_sandbox_inner( |
| 672 | &self, |
| 673 | sandbox: Sandbox, |
| 674 | image_ref: String, |
| 675 | state_dir: PathBuf, |
| 676 | tls_paths: Option<VmDriverTlsPaths>, |
| 677 | overlay_preparation: OverlayPreparation, |
| 678 | ) -> Result<(), Status> { |
| 679 | self.ensure_provisioning_active(&sandbox.id).await?; |
| 680 | let is_gpu = sandbox |
| 681 | .spec |
| 682 | .as_ref() |
| 683 | .and_then(|spec| spec.resource_requirements.as_ref()) |
| 684 | .and_then(|requirements| driver_gpu_requirements(Some(requirements))) |
| 685 | .is_some(); |
| 686 | self.publish_platform_event( |
| 687 | sandbox.id.clone(), |
| 688 | platform_event( |
| 689 | "vm", |
| 690 | "Normal", |
| 691 | "ResolvingImage", |
| 692 | format!("Resolving VM sandbox image \"{image_ref}\""), |
| 693 | ), |
| 694 | ); |
| 695 | |
| 696 | let image_plan = self.prepare_runtime_images(&sandbox.id, &image_ref).await?; |
| 697 | let image_identity = image_plan.image_identity.clone(); |
| 698 | self.ensure_provisioning_active(&sandbox.id).await?; |
| 699 | info!( |
| 700 | sandbox_id = %sandbox.id, |
| 701 | image_identity = %image_identity, |
| 702 | bootstrap_image_identity = %image_plan.bootstrap_image_identity, |
| 703 | image_disk = image_plan.image_disk.as_ref().map(|path| path.display().to_string()).unwrap_or_default(), |
| 704 | "vm driver: sandbox root disk plan resolved" |
| 705 | ); |
| 706 | let disk_paths = sandbox_runtime_disk_paths(&state_dir); |
| 707 | let root_disk = image_plan.root_disk; |
| 708 | let image_disk = image_plan.image_disk; |
| 709 | let overlay_disk = disk_paths.overlay_disk; |
| 710 | |
| 711 | self.publish_platform_event( |
| 712 | sandbox.id.clone(), |
| 713 | platform_event( |
| 714 | "vm", |
| 715 | "Normal", |
| 716 | "PreparingOverlay", |
| 717 | "Preparing writable VM overlay disk".to_string(), |
| 718 | ), |
| 719 | ); |
| 720 | if let Err(err) = self |
| 721 | .prepare_runtime_overlay( |
| 722 | &overlay_disk, |
| 723 | tls_paths.as_ref(), |
| 724 | sandbox |
| 725 | .spec |
| 726 | .as_ref() |
| 727 | .map(|spec| spec.sandbox_token.as_str()) |
| 728 | .filter(|token| !token.is_empty()), |
no test coverage detected