summaryrefslogtreecommitdiff
path: root/ironic_python_agent/hardware.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-30 12:24:44 +0000
committerGerrit Code Review <review@openstack.org>2021-04-30 12:24:44 +0000
commit10c29cdc41a461e38d0a8eeb9045d1aebfb44e8f (patch)
tree663fc1f10b7f9f856efe9ccd24649f7c10df2ae7 /ironic_python_agent/hardware.py
parentb510d2d4d0fd5f157f3d660d876d5f89b0e3defd (diff)
parented791d97786f4ed37bf7b9f18eac8e2af46c3766 (diff)
downloadironic-python-agent-10c29cdc41a461e38d0a8eeb9045d1aebfb44e8f.tar.gz
Merge "Fix getting memory size in some lshw output"
Diffstat (limited to 'ironic_python_agent/hardware.py')
-rw-r--r--ironic_python_agent/hardware.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py
index 061af3c1..be955727 100644
--- a/ironic_python_agent/hardware.py
+++ b/ironic_python_agent/hardware.py
@@ -222,16 +222,16 @@ def _calc_memory(sys_dict):
for core_child in sys_child['children']:
if not _MEMORY_ID_RE.match(core_child['id']):
continue
- if (not core_child.get("children")
- and core_child.get('size')):
+ if core_child.get('size'):
value = ("%(size)s %(units)s" % core_child)
physical += int(UNIT_CONVERTER(value).to
('MB').magnitude)
- for bank in core_child.get('children', ()):
- if bank.get('size'):
- value = ("%(size)s %(units)s" % bank)
- physical += int(UNIT_CONVERTER(value).to
- ('MB').magnitude)
+ else:
+ for bank in core_child.get('children', ()):
+ if bank.get('size'):
+ value = ("%(size)s %(units)s" % bank)
+ physical += int(UNIT_CONVERTER(value).to
+ ('MB').magnitude)
return physical