Add charDevices discoverer for devices

This change adds a charDevices discoverer and using this
for CSV, GDS, and MOFED discovery. Internally the discoverer
is a "mounts" discoverer with a charDevice locator.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2022-07-06 11:37:14 +02:00
parent 55cb82c6c8
commit beff276a52
6 changed files with 168 additions and 132 deletions

View File

@@ -30,11 +30,11 @@ type gdsDeviceDiscoverer struct {
// NewGDSDiscoverer creates a discoverer for GPUDirect Storage devices and mounts.
func NewGDSDiscoverer(logger *logrus.Logger, root string) (Discover, error) {
devices := &mounts{
logger: logger,
lookup: lookup.NewCharDeviceLocator(logger, root),
required: []string{"/dev/nvidia-fs*"},
}
devices := NewCharDeviceDiscoverer(
logger,
[]string{"/dev/nvidia-fs*"},
root,
)
udev := &mounts{
logger: logger,
@@ -59,17 +59,7 @@ func NewGDSDiscoverer(logger *logrus.Logger, root string) (Discover, error) {
// Devices discovers the nvidia-fs device nodes for use with GPUDirect Storage
func (d *gdsDeviceDiscoverer) Devices() ([]Device, error) {
devicesAsMounts, err := d.devices.Mounts()
if err != nil {
d.logger.Debugf("Could not locate GDS devices: %v", err)
return nil, nil
}
var devices []Device
for _, mount := range devicesAsMounts {
devices = append(devices, Device(mount))
}
return devices, nil
return d.devices.Devices()
}
// Mounts discovers the required mounts for GPUDirect Storage.