From 1df05f8753e7a0c97951ec931ab2a0a835e3578f Mon Sep 17 00:00:00 2001 From: Kevin Klues Date: Mon, 8 Jul 2024 11:11:51 +0000 Subject: [PATCH] Warn instead of error when a GPU has no MIG devices with mixed strategy Signed-off-by: Kevin Klues --- internal/rm/device_map.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/rm/device_map.go b/internal/rm/device_map.go index 4d2e9159d..347bf734a 100644 --- a/internal/rm/device_map.go +++ b/internal/rm/device_map.go @@ -22,6 +22,7 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvlib/info" "github.com/NVIDIA/go-nvml/pkg/nvml" + "k8s.io/klog/v2" spec "github.com/NVIDIA/k8s-device-plugin/api/config/v1" ) @@ -164,9 +165,11 @@ func (b *deviceMapBuilder) assertAllMigDevicesAreValid(uniform bool) error { if err != nil { return err } - if len(migDevices) == 0 { - i := 0 - return fmt.Errorf("device %v has an invalid MIG configuration", i) + if uniform && len(migDevices) == 0 { + return fmt.Errorf("device %v has no MIG devices configured", i) + } + if !uniform && len(migDevices) == 0 { + klog.Warningf("device %v has no MIG devices configured", i) } return nil })