wwn should always be lowercase for consistency. It's used in the URL for pushing smart data.

pull/51/head
Jason Kulatunga 4 years ago
parent 6a20228262
commit 8a336bf5c6

@ -100,7 +100,7 @@ func (d *Detect) smartCtlInfo(device *models.Device) error {
Oui: availableDeviceInfo.Wwn.Oui, Oui: availableDeviceInfo.Wwn.Oui,
Id: availableDeviceInfo.Wwn.ID, Id: availableDeviceInfo.Wwn.ID,
} }
device.WWN = wwn.ToString() device.WWN = strings.ToLower(wwn.ToString())
d.Logger.Debugf("NAA: %d OUI: %d Id: %d => WWN: %s", wwn.Naa, wwn.Oui, wwn.Id, device.WWN) d.Logger.Debugf("NAA: %d OUI: %d Id: %d => WWN: %s", wwn.Naa, wwn.Oui, wwn.Id, device.WWN)
} else { } else {
d.Logger.Info("Using WWN Fallback") d.Logger.Info("Using WWN Fallback")

@ -105,4 +105,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
d.Logger.Debugf("WWN is empty, falling back to serial number: %s", detectedDevice.SerialNumber) d.Logger.Debugf("WWN is empty, falling back to serial number: %s", detectedDevice.SerialNumber)
detectedDevice.WWN = detectedDevice.SerialNumber detectedDevice.WWN = detectedDevice.SerialNumber
} }
//wwn must always be lowercase.
detectedDevice.WWN = strings.ToLower(detectedDevice.WWN)
} }

@ -42,4 +42,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
d.Logger.Debugf("WWN is empty, falling back to serial number: %s", detectedDevice.SerialNumber) d.Logger.Debugf("WWN is empty, falling back to serial number: %s", detectedDevice.SerialNumber)
detectedDevice.WWN = detectedDevice.SerialNumber detectedDevice.WWN = detectedDevice.SerialNumber
} }
//wwn must always be lowercase.
detectedDevice.WWN = strings.ToLower(detectedDevice.WWN)
} }

@ -26,4 +26,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
if len(detectedDevice.WWN) == 0 { if len(detectedDevice.WWN) == 0 {
detectedDevice.WWN = detectedDevice.SerialNumber detectedDevice.WWN = detectedDevice.SerialNumber
} }
//wwn must always be lowercase.
detectedDevice.WWN = strings.ToLower(detectedDevice.WWN)
} }

@ -2,6 +2,7 @@ package detect
import ( import (
"fmt" "fmt"
"strings"
) )
type Wwn struct { type Wwn struct {
@ -54,5 +55,5 @@ func (wwn *Wwn) ToString() string {
//TODO: may need to support additional versions in the future. //TODO: may need to support additional versions in the future.
return fmt.Sprintf("%#x", wwnBuffer) return strings.ToLower(fmt.Sprintf("%#x", wwnBuffer))
} }

Loading…
Cancel
Save