@@ -75,6 +75,8 @@ type options struct {
7575
7676 deviceIDs []string
7777
78+ noAllDevice bool
79+
7880 // the following are used for dependency injection during spec generation.
7981 nvmllib nvml.Interface
8082}
@@ -242,6 +244,12 @@ func (m command) build() *cli.Command {
242244 Destination : & opts .deviceIDs ,
243245 Sources : cli .EnvVars ("NVIDIA_CTK_CDI_GENERATE_DEVICE_IDS" ),
244246 },
247+ & cli.BoolFlag {
248+ Name : "no-all-device" ,
249+ Usage : "Don't generate an `all` device for the resultant spec" ,
250+ Destination : & opts .noAllDevice ,
251+ Sources : cli .EnvVars ("NVIDIA_CTK_CDI_GENERATE_NO_ALL_DEVICE" ),
252+ },
245253 },
246254 }
247255
@@ -397,13 +405,18 @@ func (m command) generateSpecs(opts *options) ([]generatedSpecs, error) {
397405 spec .WithVendor (opts .vendor ),
398406 spec .WithEdits (* commonEdits .ContainerEdits ),
399407 spec .WithFormat (opts .format ),
400- spec .WithMergedDeviceOptions (
401- transform .WithName (allDeviceName ),
402- transform .WithSkipIfExists (true ),
403- ),
404408 spec .WithPermissions (0644 ),
405409 }
406410
411+ if ! opts .noAllDevice {
412+ commonSpecOptions = append (commonSpecOptions ,
413+ spec .WithMergedDeviceOptions (
414+ transform .WithName (allDeviceName ),
415+ transform .WithSkipIfExists (true ),
416+ ),
417+ )
418+ }
419+
407420 fullSpec , err := spec .New (
408421 append (commonSpecOptions ,
409422 spec .WithClass (opts .class ),
0 commit comments