Expose vendor and class as options

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-02-22 16:40:27 +02:00
parent 8be6de177f
commit 9f5e141437
2 changed files with 28 additions and 1 deletions

View File

@@ -26,6 +26,9 @@ import (
type wrapper struct {
Interface
vendor string
class string
}
type nvcdilib struct {
@@ -37,6 +40,9 @@ type nvcdilib struct {
driverRoot string
nvidiaCTKPath string
vendor string
class string
infolib info.Interface
}
@@ -83,7 +89,12 @@ func New(opts ...Option) Interface {
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.
@@ -101,6 +112,8 @@ func (l *wrapper) GetSpec() (spec.Interface, error) {
return spec.New(
spec.WithDeviceSpecs(deviceSpecs),
spec.WithEdits(*edits.ContainerEdits),
spec.WithVendor(l.vendor),
spec.WithClass(l.class),
)
}