Skip to content

Commit d7fecb3

Browse files
committed
Use requested devices for CSV CDI spec generation
Signed-off-by: Evan Lezar <[email protected]>
1 parent 795fa95 commit d7fecb3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/modifier/csv.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import (
3333
// NewCSVModifier creates a modifier that applies modications to an OCI spec if required by the runtime wrapper.
3434
// The modifications are defined by CSV MountSpecs.
3535
func NewCSVModifier(logger logger.Interface, cfg *config.Config, container image.CUDA) (oci.SpecModifier, error) {
36-
if devices := container.VisibleDevices(); len(devices) == 0 {
36+
devices := container.VisibleDevices()
37+
if len(devices) == 0 {
3738
logger.Infof("No modification required; no devices requested")
3839
return nil, nil
3940
}
@@ -63,7 +64,7 @@ func NewCSVModifier(logger logger.Interface, cfg *config.Config, container image
6364
return nil, fmt.Errorf("failed to construct CDI library: %v", err)
6465
}
6566

66-
spec, err := cdilib.GetSpec()
67+
spec, err := cdilib.GetSpec(devices...)
6768
if err != nil {
6869
return nil, fmt.Errorf("failed to get CDI spec: %v", err)
6970
}

0 commit comments

Comments
 (0)