Skip to content

Commit 7e28882

Browse files
committed
fix: health check path for device when iommuFD is supported
Signed-off-by: Rajat Chopra <rajatc@nvidia.com>
1 parent a84d71e commit 7e28882

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/device_plugin/generic_device_plugin.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,11 @@ func (dpi *GenericDevicePlugin) healthCheck() error {
328328
var path = dpi.devicePath
329329
var health = ""
330330

331+
iommufdSupported, err := supportsIOMMUFD()
332+
if err != nil {
333+
return fmt.Errorf("could not determine iommufd support: %w", err)
334+
}
335+
331336
watcher, err := fsnotify.NewWatcher()
332337
if err != nil {
333338
log.Printf("%s: Unable to create fsnotify watcher: %v", method, err)
@@ -350,7 +355,11 @@ func (dpi *GenericDevicePlugin) healthCheck() error {
350355
}
351356

352357
for _, dev := range dpi.devs {
353-
devicePath := filepath.Join(path, dev.ID)
358+
devID := dev.ID
359+
if iommufdSupported {
360+
devID = fmt.Sprintf("vfio%s", dev.ID)
361+
}
362+
devicePath := filepath.Join(path, devID)
354363
err = watcher.Add(devicePath)
355364
log.Printf(" Adding Watcher to Path : %v", devicePath)
356365
pathDeviceMap[devicePath] = dev.ID

0 commit comments

Comments
 (0)