MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate_gpu_request

Method validate_gpu_request

crates/openshell-driver-docker/src/lib.rs:531–554  ·  view source on GitHub ↗
(
        gpu_requirements: Option<&GpuResourceRequirements>,
        supports_gpu: bool,
        driver_config: &DockerSandboxDriverConfig,
    )

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Tested by

no test coverage detected