From 7c21a2da2c931089e4ec2b86ae35a510f2f7793d Mon Sep 17 00:00:00 2001 From: SWWBF <1152719547@qq.com> Date: Mon, 10 Jul 2023 05:52:54 +0800 Subject: [PATCH 06/11] some kvm has no slot which may cause panic of atune --- atune_collector/plugin/monitor/memory/bandwidth.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/atune_collector/plugin/monitor/memory/bandwidth.py b/atune_collector/plugin/monitor/memory/bandwidth.py index f44925f..6d59ab6 100755 --- a/atune_collector/plugin/monitor/memory/bandwidth.py +++ b/atune_collector/plugin/monitor/memory/bandwidth.py @@ -158,12 +158,13 @@ class MemBandwidth(Monitor): for dimm in info["memorys"][0]["children"]: if dimm.get("size") is None: continue - locator = memtopo.table_get_locator(dimm["slot"]) - if locator is None: - continue - if dimms[locator[0]][locator[1]] == 0: - dimms[locator[0]][locator[1]] = dimm["width"] * \ - memtopo.table_get_freq(dimm["description"]) / 8 + if "slot" in dimm: + locator = memtopo.table_get_locator(dimm["slot"]) + if locator is None: + continue + if dimms[locator[0]][locator[1]] == 0: + dimms[locator[0]][locator[1]] = dimm["width"] * \ + memtopo.table_get_freq(dimm["description"]) / 8 ret = 0 for channel in dimms[socket]: ret += channel -- 2.27.0