Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

skip the empty slots & handle the out of spec memory type #1243

Merged
merged 2 commits into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions grid-proxy/internal/indexer/dmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (

const (
DmiCallCmd = "zos.system.dmi"

outOfSpec = "<OUT OF SPEC>"
unknown = "Unknown"
other = "Other"
)

type DMIWork struct {
Expand Down Expand Up @@ -40,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 {
Expand All @@ -63,11 +66,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 := subSec.Properties["Type"].Val
if memType == outOfSpec {
memType = unknown
}

info.Memory = append(info.Memory, types.Memory{
Type: subSec.Properties["Type"].Val,
Type: memType,
Manufacturer: subSec.Properties["Manufacturer"].Val,
})
}
Expand Down
Loading