(
&self,
sandbox_id: &str,
state_dir: &Path,
reason: &str,
message: &str,
remove_state: bool,
)
| 1640 | } |
| 1641 | |
| 1642 | async fn fail_provisioning( |
| 1643 | &self, |
| 1644 | sandbox_id: &str, |
| 1645 | state_dir: &Path, |
| 1646 | reason: &str, |
| 1647 | message: &str, |
| 1648 | remove_state: bool, |
| 1649 | ) { |
| 1650 | self.release_gpu_and_subnet(sandbox_id); |
| 1651 | let snapshot = { |
| 1652 | let mut registry = self.registry.lock().await; |
| 1653 | let Some(record) = registry.get_mut(sandbox_id) else { |
| 1654 | return; |
| 1655 | }; |
| 1656 | if record.deleting { |
| 1657 | return; |
| 1658 | } |
| 1659 | record.process = None; |
| 1660 | record.provisioning_task = None; |
| 1661 | record.gpu_bdf = None; |
| 1662 | record.qemu_network_allocated = false; |
| 1663 | record.snapshot.status = Some(status_with_condition( |
| 1664 | &record.snapshot, |
| 1665 | error_condition(reason, message), |
| 1666 | false, |
| 1667 | )); |
| 1668 | Some(record.snapshot.clone()) |
| 1669 | }; |
| 1670 | |
| 1671 | if remove_state { |
| 1672 | let _ = tokio::fs::remove_dir_all(state_dir).await; |
| 1673 | } |
| 1674 | self.publish_platform_event( |
| 1675 | sandbox_id.to_string(), |
| 1676 | platform_event( |
| 1677 | "vm", |
| 1678 | "Warning", |
| 1679 | reason, |
| 1680 | format!("VM provisioning failed: {message}"), |
| 1681 | ), |
| 1682 | ); |
| 1683 | if let Some(snapshot) = snapshot { |
| 1684 | self.publish_snapshot(snapshot); |
| 1685 | } |
| 1686 | } |
| 1687 | |
| 1688 | async fn prepare_runtime_images( |
| 1689 | &self, |
no test coverage detected