Fix NVIDIA GPU serial number format extraction

Extract decimal serial numbers from devname parameters (e.g., "SXM5_SN_1653925027099")
instead of hex PCIe Device Serial Numbers. This provides the correct GPU serial
numbers as they appear in NVIDIA diagnostics tooling.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 22:57:50 +03:00
parent bcce975fd6
commit 77e25ddc02
3 changed files with 40 additions and 119 deletions

View File

@@ -119,27 +119,3 @@ func findSubstring(s, substr string) bool {
return false
}
func TestFormatGPUSerial(t *testing.T) {
tests := []struct {
input string
expected string
}{
{
input: "14-17-dc-65-77-2d-b0-48",
expected: "48:B0:2D:77:65:DC:17:14",
},
{
input: "f2-fd-85-e0-2f-2d-b0-48",
expected: "48:B0:2D:2F:E0:85:FD:F2",
},
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
result := formatGPUSerial(tt.input)
if result != tt.expected {
t.Errorf("formatGPUSerial(%s) = %s, want %s", tt.input, result, tt.expected)
}
})
}
}