(
gpu_requirements: Option<&GpuResourceRequirements>,
supports_gpu: bool,
driver_config: &DockerSandboxDriverConfig,
)
| 529 | } |
| 530 | |
| 531 | fn validate_gpu_request( |
| 532 | gpu_requirements: Option<&GpuResourceRequirements>, |
| 533 | supports_gpu: bool, |
| 534 | driver_config: &DockerSandboxDriverConfig, |
| 535 | ) -> Result<(), Status> { |
| 536 | let requested_count = |
| 537 | effective_driver_gpu_count(gpu_requirements).map_err(Status::invalid_argument)?; |
| 538 | if requested_count.is_some() && !supports_gpu { |
| 539 | return Err(Status::failed_precondition( |
| 540 | "docker GPU sandboxes require Docker CDI support. Enable CDI on the Docker daemon, then restart the OpenShell gateway/server so GPU capability is detected.", |
| 541 | )); |
| 542 | } |
| 543 | |
| 544 | if let Some(cdi_devices) = driver_config.cdi_devices.as_deref() { |
| 545 | validate_specific_gpu_device_request( |
| 546 | gpu_requirements, |
| 547 | cdi_devices, |
| 548 | "driver_config.cdi_devices", |
| 549 | ) |
| 550 | .map_err(Status::invalid_argument)?; |
| 551 | } |
| 552 | |
| 553 | Ok(()) |
| 554 | } |
| 555 | |
| 556 | async fn validate_user_volume_mounts_available( |
| 557 | &self, |
nothing calls this directly
no test coverage detected