Skip to content

Commit

Permalink
Adding log messages and updating unit test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Vishesh Tanksale <vtanksale@nvidia.com>
  • Loading branch information
visheshtanksale committed Jun 27, 2024
1 parent 8f10948 commit 7d0e252
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/lm/nvml.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"strconv"
"strings"

"k8s.io/klog/v2"

"github.com/NVIDIA/go-nvlib/pkg/nvpci"

spec "github.com/NVIDIA/k8s-device-plugin/api/config/v1"
Expand Down Expand Up @@ -222,6 +224,7 @@ func getModeForClasses(classes []uint32) string {
}
for _, class := range classes {
if class != classes[0] {
klog.Infof("Not all GPU devices belong to the same class %#06x ", classes)
return "unknown"
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/resource/testing/resource-testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewDeviceMock(migEnabled bool) *DeviceMock {
IsMigEnabledFunc: func() (bool, error) { return migEnabled, nil },
IsMigCapableFunc: func() (bool, error) { return migEnabled, nil },
GetMigDevicesFunc: func() ([]resource.Device, error) { return nil, nil },
GetPCIClassFunc: func() (uint32, error) { return 0x030000, nil },
GetPCIClassFunc: func() (uint32, error) { return 0, nil },
}}
return &d
}
Expand Down
2 changes: 1 addition & 1 deletion tests/expected-output-mig-single.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ nvidia\.com\/gpu\.engines\.jpeg=[0-9]+
nvidia\.com\/gpu\.engines\.ofa=[0-9]+
nvidia\.com\/gpu\.slices\.gi=[0-9]+
nvidia\.com\/gpu\.slices\.ci=[0-9]+
nvidia\.com\/gpu\.mode=[unknown|compute|graphics]
nvidia\.com\/gpu\.mode=[compute]
nvidia\.com\/mps\.capable=[true|false]

0 comments on commit 7d0e252

Please sign in to comment.