(
&self,
sandbox: Sandbox,
image_ref: String,
state_dir: PathBuf,
tls_paths: Option<VmDriverTlsPaths>,
overlay_preparation: OverlayPreparation,
)
| 626 | } |
| 627 | |
| 628 | async fn provision_sandbox( |
| 629 | &self, |
| 630 | sandbox: Sandbox, |
| 631 | image_ref: String, |
| 632 | state_dir: PathBuf, |
| 633 | tls_paths: Option<VmDriverTlsPaths>, |
| 634 | overlay_preparation: OverlayPreparation, |
| 635 | ) { |
| 636 | let sandbox_id = sandbox.id.clone(); |
| 637 | if let Err(err) = self |
| 638 | .provision_sandbox_inner( |
| 639 | sandbox, |
| 640 | image_ref, |
| 641 | state_dir.clone(), |
| 642 | tls_paths, |
| 643 | overlay_preparation, |
| 644 | ) |
| 645 | .await |
| 646 | { |
| 647 | if err.code() == tonic::Code::Cancelled { |
| 648 | if overlay_preparation == OverlayPreparation::Fresh { |
| 649 | let _ = tokio::fs::remove_dir_all(&state_dir).await; |
| 650 | } |
| 651 | return; |
| 652 | } |
| 653 | |
| 654 | warn!( |
| 655 | sandbox_id = %sandbox_id, |
| 656 | error = %err.message(), |
| 657 | "vm driver: sandbox provisioning failed" |
| 658 | ); |
| 659 | self.fail_provisioning( |
| 660 | &sandbox_id, |
| 661 | &state_dir, |
| 662 | "ProvisioningFailed", |
| 663 | err.message(), |
| 664 | overlay_preparation == OverlayPreparation::Fresh, |
| 665 | ) |
| 666 | .await; |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | #[allow(clippy::result_large_err)] |
| 671 | async fn provision_sandbox_inner( |
no test coverage detected