(&self, sandbox: &Sandbox)
| 417 | } |
| 418 | |
| 419 | pub async fn validate_sandbox_create(&self, sandbox: &Sandbox) -> Result<(), tonic::Status> { |
| 420 | let _ = KubernetesSandboxDriverConfig::from_sandbox(sandbox) |
| 421 | .map_err(tonic::Status::invalid_argument)?; |
| 422 | let gpu_requirements = sandbox |
| 423 | .spec |
| 424 | .as_ref() |
| 425 | .and_then(|spec| driver_gpu_requirements(spec.resource_requirements.as_ref())); |
| 426 | validate_gpu_request(gpu_requirements)?; |
| 427 | if gpu_requirements.is_some() |
| 428 | && !self.has_gpu_capacity().await.map_err(|err| { |
| 429 | tonic::Status::internal(format!("check GPU node capacity failed: {err}")) |
| 430 | })? |
| 431 | { |
| 432 | return Err(tonic::Status::failed_precondition( |
| 433 | "GPU sandbox requested, but the active gateway has no allocatable GPUs. Please refer to documentation and use `openshell doctor` commands to inspect GPU support and gateway configuration.", |
| 434 | )); |
| 435 | } |
| 436 | Ok(()) |
| 437 | } |
| 438 | |
| 439 | pub async fn get_sandbox(&self, name: &str) -> Result<Option<Sandbox>, String> { |
| 440 | info!( |
nothing calls this directly
no test coverage detected