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

Method validated_sandbox

crates/openshell-driver-docker/src/lib.rs:466–491  ·  view source on GitHub ↗
(
        sandbox: &'a DriverSandbox,
        config: &DockerDriverRuntimeConfig,
    )

Source from the content-addressed store, hash-verified

464 }
465
466 fn validated_sandbox<'a>(
467 sandbox: &'a DriverSandbox,
468 config: &DockerDriverRuntimeConfig,
469 ) -> Result<ValidatedDockerSandbox<'a>, Status> {
470 let spec = sandbox
471 .spec
472 .as_ref()
473 .ok_or_else(|| Status::invalid_argument("sandbox.spec is required"))?;
474 let template = spec
475 .template
476 .as_ref()
477 .ok_or_else(|| Status::invalid_argument("sandbox.spec.template is required"))?;
478
479 Self::validate_sandbox_template_base(template)?;
480 let _ = docker_resource_limits(template)?;
481 let driver_config =
482 DockerSandboxDriverConfig::from_template(template).map_err(Status::invalid_argument)?;
483 validate_docker_driver_mounts(&driver_config.mounts, config.enable_bind_mounts)?;
484 let gpu_requirements = driver_gpu_requirements(spec.resource_requirements.as_ref());
485 Self::validate_gpu_request(gpu_requirements, config.supports_gpu, &driver_config)?;
486 Ok(ValidatedDockerSandbox {
487 template,
488 driver_config,
489 gpu_requirements,
490 })
491 }
492
493 fn validate_sandbox_template_base(template: &DriverSandboxTemplate) -> Result<(), Status> {
494 if template.image.trim().is_empty() {

Callers

nothing calls this directly

Calls 4

docker_resource_limitsFunction · 0.85
driver_gpu_requirementsFunction · 0.85
validate_gpu_requestFunction · 0.50

Tested by

no test coverage detected