feat(models): resolve CPU serial from source PPIN as common fallback
Centralize CPU identity in models.ResolveCPUSerialNumber: an explicit source serial wins, otherwise a valid source PPIN is used, placeholders rejected. Dell, H3C and Redfish apply it while parsing; canonical-device and Reanimator conversion apply it again at the output boundary. No identity is synthesized from socket/model/board serial. See ADL-058. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
9d701885da
commit
07c270cda2
+4
-2
@@ -19,7 +19,7 @@ import (
|
||||
"git.mchus.pro/mchus/logpile/internal/parser/vendors/pciids"
|
||||
)
|
||||
|
||||
const parserVersion = "3.0"
|
||||
const parserVersion = "3.1"
|
||||
|
||||
func init() {
|
||||
parser.Register(&Parser{})
|
||||
@@ -323,6 +323,7 @@ func parseCPUView(props map[string]string, result *models.AnalysisResult) {
|
||||
if model == "" {
|
||||
return
|
||||
}
|
||||
ppin := strings.TrimSpace(props["ppin"])
|
||||
cpu := models.CPU{
|
||||
Socket: parseSocketFromFQDD(firstNonEmpty(props["fqdd"], props["instanceid"])),
|
||||
Model: model,
|
||||
@@ -331,7 +332,8 @@ func parseCPUView(props map[string]string, result *models.AnalysisResult) {
|
||||
Threads: parseIntLoose(props["numberofenabledthreads"]),
|
||||
FrequencyMHz: parseIntLoose(props["currentclockspeed"]),
|
||||
MaxFreqMHz: parseIntLoose(props["maxclockspeed"]),
|
||||
PPIN: strings.TrimSpace(props["ppin"]),
|
||||
PPIN: ppin,
|
||||
SerialNumber: models.ResolveCPUSerialNumber(props["serialnumber"], ppin),
|
||||
Status: normalizeStatus(props["primarystatus"]),
|
||||
}
|
||||
result.Hardware.CPUs = append(result.Hardware.CPUs, cpu)
|
||||
|
||||
+3
@@ -152,6 +152,9 @@ func TestParseNestedTSRZip(t *testing.T) {
|
||||
if got := result.Hardware.CPUs[0].Model; got != "Intel(R) Xeon(R) Gold 6330" {
|
||||
t.Fatalf("unexpected cpu model: %q", got)
|
||||
}
|
||||
if got := result.Hardware.CPUs[0].SerialNumber; got != "ABCD" {
|
||||
t.Fatalf("expected CPU serial fallback from PPIN, got %q", got)
|
||||
}
|
||||
|
||||
if len(result.Hardware.NetworkAdapters) != 1 {
|
||||
t.Fatalf("expected 1 network adapter, got %d", len(result.Hardware.NetworkAdapters))
|
||||
|
||||
Reference in New Issue
Block a user