mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Expose vendor and class as options
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
8be6de177f
commit
9f5e141437
@ -26,6 +26,9 @@ import (
|
|||||||
|
|
||||||
type wrapper struct {
|
type wrapper struct {
|
||||||
Interface
|
Interface
|
||||||
|
|
||||||
|
vendor string
|
||||||
|
class string
|
||||||
}
|
}
|
||||||
|
|
||||||
type nvcdilib struct {
|
type nvcdilib struct {
|
||||||
@ -37,6 +40,9 @@ type nvcdilib struct {
|
|||||||
driverRoot string
|
driverRoot string
|
||||||
nvidiaCTKPath string
|
nvidiaCTKPath string
|
||||||
|
|
||||||
|
vendor string
|
||||||
|
class string
|
||||||
|
|
||||||
infolib info.Interface
|
infolib info.Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +89,12 @@ func New(opts ...Option) Interface {
|
|||||||
panic("Unknown mode")
|
panic("Unknown mode")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &wrapper{Interface: lib}
|
w := wrapper{
|
||||||
|
Interface: lib,
|
||||||
|
vendor: l.vendor,
|
||||||
|
class: l.class,
|
||||||
|
}
|
||||||
|
return &w
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSpec combines the device specs and common edits from the wrapped Interface to a single spec.Interface.
|
// GetSpec combines the device specs and common edits from the wrapped Interface to a single spec.Interface.
|
||||||
@ -101,6 +112,8 @@ func (l *wrapper) GetSpec() (spec.Interface, error) {
|
|||||||
return spec.New(
|
return spec.New(
|
||||||
spec.WithDeviceSpecs(deviceSpecs),
|
spec.WithDeviceSpecs(deviceSpecs),
|
||||||
spec.WithEdits(*edits.ContainerEdits),
|
spec.WithEdits(*edits.ContainerEdits),
|
||||||
|
spec.WithVendor(l.vendor),
|
||||||
|
spec.WithClass(l.class),
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,3 +73,17 @@ func WithMode(mode string) Option {
|
|||||||
l.mode = mode
|
l.mode = mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithVendor sets the vendor for the library
|
||||||
|
func WithVendor(vendor string) Option {
|
||||||
|
return func(o *nvcdilib) {
|
||||||
|
o.vendor = vendor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithClass sets the class for the library
|
||||||
|
func WithClass(class string) Option {
|
||||||
|
return func(o *nvcdilib) {
|
||||||
|
o.class = class
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user