mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 21:39:10 +00:00
Determine the minumum required spec version
This change uses functionality from the CDI package to determine the minimum required CDI spec version. This allows for a spec with the widest compatibility to be specified. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
bc4bfb94a2
commit
eaf9bdaeb4
@ -249,15 +249,20 @@ func (m command) generateSpec(root string, nvidiaCTKPath string) (*specs.Spec, e
|
|||||||
|
|
||||||
allEdits.Append(commonEdits)
|
allEdits.Append(commonEdits)
|
||||||
|
|
||||||
// Construct the spec
|
// We construct the spec and determine the minimum required version based on the specification.
|
||||||
// TODO: Use the code to determine the minimal version
|
|
||||||
spec := specs.Spec{
|
spec := specs.Spec{
|
||||||
Version: "0.4.0",
|
Version: "NOT_SET",
|
||||||
Kind: "nvidia.com/gpu",
|
Kind: "nvidia.com/gpu",
|
||||||
Devices: deviceSpecs,
|
Devices: deviceSpecs,
|
||||||
ContainerEdits: *allEdits.ContainerEdits,
|
ContainerEdits: *allEdits.ContainerEdits,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minVersion, err := cdi.MinimumRequiredVersion(&spec)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to get minumum required CDI spec version: %v", err)
|
||||||
|
}
|
||||||
|
spec.Version = minVersion
|
||||||
|
|
||||||
return &spec, nil
|
return &spec, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user