Skip to content

Commit 2639cfe

Browse files
committed
fixup! Enable CDI in runtime if CDI_ENABLED is set
1 parent dfe3f8a commit 2639cfe

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cmd/nvidia-ctk-installer/container/toolkit/toolkit.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ func (t *Installer) createDeviceNodes(opts *Options) error {
703703

704704
// generateCDISpec generates a CDI spec for use in management containers
705705
func (t *Installer) generateCDISpec(opts *Options, nvidiaCDIHookPath string) error {
706-
if !opts.cdiEnabled {
706+
if !opts.CDI.Enabled {
707707
return nil
708708
}
709709
t.logger.Info("Generating CDI spec for management containers")
@@ -713,8 +713,8 @@ func (t *Installer) generateCDISpec(opts *Options, nvidiaCDIHookPath string) err
713713
nvcdi.WithDriverRoot(opts.DriverRootCtrPath),
714714
nvcdi.WithDevRoot(opts.DevRootCtrPath),
715715
nvcdi.WithNVIDIACDIHookPath(nvidiaCDIHookPath),
716-
nvcdi.WithVendor(opts.cdiVendor),
717-
nvcdi.WithClass(opts.cdiClass),
716+
nvcdi.WithVendor(opts.CDI.vendor),
717+
nvcdi.WithClass(opts.CDI.class),
718718
)
719719
if err != nil {
720720
return fmt.Errorf("failed to create CDI library for management containers: %v", err)
@@ -739,7 +739,7 @@ func (t *Installer) generateCDISpec(opts *Options, nvidiaCDIHookPath string) err
739739
if err != nil {
740740
return fmt.Errorf("failed to generate CDI name for management containers: %v", err)
741741
}
742-
err = spec.Save(filepath.Join(opts.cdiOutputDir, name))
742+
err = spec.Save(filepath.Join(opts.CDI.outputDir, name))
743743
if err != nil {
744744
return fmt.Errorf("failed to save CDI spec for management containers: %v", err)
745745
}

cmd/nvidia-ctk-installer/container/toolkit/toolkit_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ kind: example.com/class
124124
options := Options{
125125
DriverRoot: "/host/driver/root",
126126
DriverRootCtrPath: filepath.Join(moduleRoot, "testdata", "lookup", tc.hostRoot),
127-
cdiEnabled: tc.cdiEnabled,
128-
cdiOutputDir: cdiOutputDir,
129-
cdiKind: "example.com/class",
127+
CDI: cdiOptions{
128+
Enabled: tc.cdiEnabled,
129+
outputDir: cdiOutputDir,
130+
kind: "example.com/class",
131+
},
130132
}
131133

132134
ti := NewInstaller(

cmd/nvidia-ctk-installer/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ type options struct {
3939
root string
4040
pidFile string
4141

42-
cdiEnabled bool
43-
4442
toolkitOptions toolkit.Options
4543
runtimeOptions runtime.Options
4644
}

0 commit comments

Comments
 (0)