From 908ea83719cbdadb8b68ec1ac8375c422c46ab75 Mon Sep 17 00:00:00 2001 From: Omar Abdulaziz Date: Mon, 4 Nov 2024 17:01:00 +0200 Subject: [PATCH 1/2] skip the empty slots & handle the out of spec memory type --- grid-proxy/internal/indexer/dmi.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/grid-proxy/internal/indexer/dmi.go b/grid-proxy/internal/indexer/dmi.go index c6e9a4cb9..5df963bfb 100644 --- a/grid-proxy/internal/indexer/dmi.go +++ b/grid-proxy/internal/indexer/dmi.go @@ -12,6 +12,10 @@ import ( const ( DmiCallCmd = "zos.system.dmi" + + outOfSpec = "" + unknown = "Unknown" + other = "Other" ) type DMIWork struct { @@ -63,11 +67,20 @@ func parseDmiResponse(dmiResponse zosDmiTypes.DMI, twinId uint32) types.Dmi { if sec.TypeStr == "MemoryDevice" { for _, subSec := range sec.SubSections { if subSec.Title == "Memory Device" { - if subSec.Properties["Type"].Val == "Unknown" { + // skips the empty slots + if subSec.Properties["Type"].Val == other && + subSec.Properties["Manufacturer"].Val == unknown { continue } + + // proper unknown memory type + memType := "lol" + if memType == outOfSpec { + memType = unknown + } + info.Memory = append(info.Memory, types.Memory{ - Type: subSec.Properties["Type"].Val, + Type: memType, Manufacturer: subSec.Properties["Manufacturer"].Val, }) } From e5f240c7a23f8bffafd60950f0de03117cc29ffd Mon Sep 17 00:00:00 2001 From: Omar Abdulaziz Date: Sun, 8 Dec 2024 12:11:07 +0200 Subject: [PATCH 2/2] clean test step --- grid-proxy/internal/indexer/dmi.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grid-proxy/internal/indexer/dmi.go b/grid-proxy/internal/indexer/dmi.go index 5df963bfb..278789a71 100644 --- a/grid-proxy/internal/indexer/dmi.go +++ b/grid-proxy/internal/indexer/dmi.go @@ -44,7 +44,6 @@ func (w *DMIWork) Get(ctx context.Context, rmb *peer.RpcClient, twinId uint32) ( res := parseDmiResponse(dmi, twinId) return []types.Dmi{res}, nil - } func (w *DMIWork) Upsert(ctx context.Context, db db.Database, batch []types.Dmi) error { @@ -74,7 +73,7 @@ func parseDmiResponse(dmiResponse zosDmiTypes.DMI, twinId uint32) types.Dmi { } // proper unknown memory type - memType := "lol" + memType := subSec.Properties["Type"].Val if memType == outOfSpec { memType = unknown }