nvidia: improve component mapping, firmware, statuses and check times
This commit is contained in:
@@ -410,8 +410,12 @@ func (s *Server) handleGetSerials(w http.ResponseWriter, r *http.Request) {
|
||||
if !hasUsableSerial(pcie.SerialNumber) {
|
||||
continue
|
||||
}
|
||||
component := pcie.DeviceClass
|
||||
if strings.EqualFold(strings.TrimSpace(pcie.DeviceClass), "NVSwitch") && strings.TrimSpace(pcie.PartNumber) != "" {
|
||||
component = strings.TrimSpace(pcie.PartNumber)
|
||||
}
|
||||
serials = append(serials, SerialEntry{
|
||||
Component: pcie.DeviceClass,
|
||||
Component: component,
|
||||
Location: pcie.Slot,
|
||||
SerialNumber: strings.TrimSpace(pcie.SerialNumber),
|
||||
Manufacturer: pcie.Manufacturer,
|
||||
@@ -526,6 +530,36 @@ func extractFirmwareComponentAndModel(deviceName string) (component, model strin
|
||||
return "NIC", "-"
|
||||
}
|
||||
|
||||
// For "GPU GPUSXM5 (692-2G520-0280-501)" -> component: "GPU", model: "GPUSXM5 (692-2G520-0280-501)"
|
||||
if strings.HasPrefix(deviceName, "GPU ") {
|
||||
if idx := strings.Index(deviceName, "("); idx != -1 {
|
||||
model = strings.TrimSpace(strings.Trim(deviceName[idx:], "()"))
|
||||
if model != "" {
|
||||
return "GPU", model
|
||||
}
|
||||
}
|
||||
model = strings.TrimSpace(strings.TrimPrefix(deviceName, "GPU "))
|
||||
if model == "" {
|
||||
return "GPU", "-"
|
||||
}
|
||||
return "GPU", model
|
||||
}
|
||||
|
||||
// For "NVSwitch NVSWITCH2 (NVSWITCH2)" -> component: "NVSwitch", model: "NVSWITCH2 (NVSWITCH2)"
|
||||
if strings.HasPrefix(deviceName, "NVSwitch ") {
|
||||
if idx := strings.Index(deviceName, "("); idx != -1 {
|
||||
model = strings.TrimSpace(strings.Trim(deviceName[idx:], "()"))
|
||||
if model != "" {
|
||||
return "NVSwitch", model
|
||||
}
|
||||
}
|
||||
model = strings.TrimSpace(strings.TrimPrefix(deviceName, "NVSwitch "))
|
||||
if model == "" {
|
||||
return "NVSwitch", "-"
|
||||
}
|
||||
return "NVSwitch", model
|
||||
}
|
||||
|
||||
// For "HDD Samsung MZ7L33T8HBNA-00A07" -> component: "HDD", model: "Samsung MZ7L33T8HBNA-00A07"
|
||||
if strings.HasPrefix(deviceName, "HDD ") {
|
||||
return "HDD", strings.TrimPrefix(deviceName, "HDD ")
|
||||
|
||||
Reference in New Issue
Block a user