mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix glob pattern to search for all TPU devices in /sys/devices.
Also fix the device file path used to fetch device ID. Co-authored-by: Lucas Manning <lucasmanning@google.com> PiperOrigin-RevId: 583112662
This commit is contained in:
committed by
gVisor bot
co-authored by
Lucas Manning
parent
f154acfb7b
commit
7f5733ea38
+2
-2
@@ -1196,7 +1196,7 @@ func tpuProxyRegisterDevices(info *containerInfo, vfsObj *vfs.VirtualFilesystem)
|
||||
}
|
||||
// At this point /sys/devices/pci0000:00/<pci_address>/accel/accel# contains
|
||||
// all the TPU devices on the host. Enumerate them and register TPU devices.
|
||||
pciAddrs, err := filepath.Glob("/sys/devices/pci0000:00/*")
|
||||
pciAddrs, err := filepath.Glob("/sys/devices/pci0000:00/*/accel/accel*")
|
||||
if err != nil {
|
||||
return fmt.Errorf("enumerating PCI device files: %w", err)
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ func tpuProxyRegisterDevices(info *containerInfo, vfsObj *vfs.VirtualFilesystem)
|
||||
return fmt.Errorf("parsing PCI device number: %w", err)
|
||||
}
|
||||
var deviceIDBytes []byte
|
||||
if deviceIDBytes, err = os.ReadFile(path.Join(pciPath, "device")); err != nil {
|
||||
if deviceIDBytes, err = os.ReadFile(path.Join(pciPath, "device/device")); err != nil {
|
||||
return fmt.Errorf("reading PCI device ID: %w", err)
|
||||
}
|
||||
deviceIDStr := strings.Replace(string(deviceIDBytes), "0x", "", -1)
|
||||
|
||||
Reference in New Issue
Block a user