Fix #2469 omit memory.numa_stat when not available
Signed-off-by: Katarzyna Kujawa <katarzyna.kujawa@intel.com>
This commit is contained in:
parent
fdc48376d1
commit
71e63de4a3
|
@ -291,7 +291,9 @@ func getPageUsageByNUMA(cgroupPath string) (cgroups.PageUsageByNUMA, error) {
|
||||||
stats := cgroups.PageUsageByNUMA{}
|
stats := cgroups.PageUsageByNUMA{}
|
||||||
|
|
||||||
file, err := os.Open(path.Join(cgroupPath, cgroupMemoryPagesByNuma))
|
file, err := os.Open(path.Join(cgroupPath, cgroupMemoryPagesByNuma))
|
||||||
if err != nil {
|
if os.IsNotExist(err) {
|
||||||
|
return stats, nil
|
||||||
|
} else if err != nil {
|
||||||
return stats, err
|
return stats, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,3 +504,14 @@ func TestNoHierarchicalNumaStat(t *testing.T) {
|
||||||
}
|
}
|
||||||
expectPageUsageByNUMAEquals(t, pageUsageByNUMA, actualStats)
|
expectPageUsageByNUMAEquals(t, pageUsageByNUMA, actualStats)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWithoutNumaStat(t *testing.T) {
|
||||||
|
helper := NewCgroupTestUtil("memory", t)
|
||||||
|
defer helper.cleanup()
|
||||||
|
|
||||||
|
actualStats, err := getPageUsageByNUMA(helper.CgroupPath)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
expectPageUsageByNUMAEquals(t, cgroups.PageUsageByNUMA{}, actualStats)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue