Skip to content

Commit 4b9f067

Browse files
committed
update vfio validation
Signed-off-by: Arjun <[email protected]>
1 parent 0428e9c commit 4b9f067

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

cmd/nvidia-validator/main.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,22 @@ func (v *VGPUDevices) validate() error {
17341734
}
17351735

17361736
func (v *VGPUDevices) runValidation() error {
1737+
nvpci := nvpci.New()
1738+
GPUDevices, err := nvpci.GetGPUs()
1739+
if err != nil {
1740+
return fmt.Errorf("error checking for GPU devices on the host: %w", err)
1741+
}
1742+
for _, device := range GPUDevices {
1743+
if device.SriovInfo.PhysicalFunction == nil {
1744+
continue
1745+
}
1746+
totalVF := int(device.SriovInfo.PhysicalFunction.TotalVFs)
1747+
if totalVF > 0 {
1748+
log.Infof("Found GPU device with SR-IOV VFs: %s (TotalVFs: %d)", device.Address, totalVF)
1749+
return nil
1750+
}
1751+
}
1752+
17371753
nvmdev := nvmdev.New()
17381754
vGPUDevices, err := nvmdev.GetAllDevices()
17391755
if err != nil {
@@ -1746,14 +1762,14 @@ func (v *VGPUDevices) runValidation() error {
17461762
return fmt.Errorf("no vGPU devices found")
17471763
}
17481764

1749-
log.Infof("Found %d vGPU devices", numDevices)
1765+
log.Infof("Found %d MDEV vGPU devices", numDevices)
17501766
return nil
17511767
}
17521768

17531769
for {
17541770
numDevices := len(vGPUDevices)
17551771
if numDevices > 0 {
1756-
log.Infof("Found %d vGPU devices", numDevices)
1772+
log.Infof("Found %d MDEV vGPU devices", numDevices)
17571773
return nil
17581774
}
17591775
log.Infof("No vGPU devices found, retrying after %d seconds", sleepIntervalSecondsFlag)

0 commit comments

Comments
 (0)