mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-05 04:59:18 +00:00
Check for required device majors
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
05632c0a40
commit
315f4adb8f
@ -40,12 +40,23 @@ func newAllPossible(logger *logrus.Logger, driverRoot string) (nodeLister, error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed reading device majors: %v", err)
|
return nil, fmt.Errorf("failed reading device majors: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var requiredMajors []devices.Name
|
||||||
migCaps, err := nvcaps.NewMigCaps()
|
migCaps, err := nvcaps.NewMigCaps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read MIG caps: %v", err)
|
return nil, fmt.Errorf("failed to read MIG caps: %v", err)
|
||||||
}
|
}
|
||||||
if migCaps == nil {
|
if migCaps == nil {
|
||||||
migCaps = make(nvcaps.MigCaps)
|
migCaps = make(nvcaps.MigCaps)
|
||||||
|
} else {
|
||||||
|
requiredMajors = append(requiredMajors, devices.NVIDIACaps)
|
||||||
|
}
|
||||||
|
|
||||||
|
requiredMajors = append(requiredMajors, devices.NVIDIAGPU, devices.NVIDIAUVM)
|
||||||
|
for _, name := range requiredMajors {
|
||||||
|
if !deviceMajors.Exists(name) {
|
||||||
|
return nil, fmt.Errorf("missing required device major %s", name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
l := allPossible{
|
l := allPossible{
|
||||||
|
Loading…
Reference in New Issue
Block a user