From 17b094d8d69d7adb4e24814625d733cb4f5f0ac8 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 23 Nov 2021 20:33:50 +0200 Subject: [PATCH] source/memory: fix memory.numa label --- source/memory/memory.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/memory/memory.go b/source/memory/memory.go index 823ad41fb..27670e830 100644 --- a/source/memory/memory.go +++ b/source/memory/memory.go @@ -60,7 +60,7 @@ func (s *memorySource) GetLabels() (source.FeatureLabels, error) { features := s.GetFeatures() // NUMA - if len(features.Values[NumaFeature].Elements) > 0 { + if isNuma, ok := features.Values[NumaFeature].Elements["is_numa"]; ok && isNuma == "true" { labels["numa"] = true } @@ -118,7 +118,10 @@ func detectNuma() (map[string]string, error) { return nil, fmt.Errorf("failed to list numa nodes: %w", err) } - return map[string]string{"node_count": strconv.Itoa(len(nodes))}, nil + return map[string]string{ + "is_numa": strconv.FormatBool(len(nodes) > 1), + "node_count": strconv.Itoa(len(nodes)), + }, nil } // detectNv detects NVDIMM devices