Ramdisk should consider the size unit when inspecting the amount of RAM

Bug #1486689 reported by Lucas Alvares Gomes
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic Inspector
Invalid
High
Brad Lodgen
diskimage-builder
Opinion
Medium
Joey D.

Bug Description

The code that inspect the amount of RAM [1] is not considering the size unit and assumes MB which may lead to the wrong size to be registered in Ironic.

<snippet>

RAM=0
for i in $(dmidecode --type memory | grep Size | awk '{ print $2; }' | grep -E '[0-9]+');
do
    RAM=$(( RAM + $i ));
done
update ".memory_mb = $RAM"

</snippet>

On IRC it was reported that dmidecode sometimes shows "Size" in GB:

<lodgenbd> lucas-hungry: dmidecode returns this for each DIMM: "Size: 32 GB" so that code just adds up all the 32's and gets to 512

We should fix that.

Also, instead of using dmidecode we could look at use /proc/meminfo instead.

[1] https://github.com/openstack/diskimage-builder/blob/master/elements/ironic-discoverd-ramdisk/init.d/80-ironic-discoverd-ramdisk#L46-L51

summary: - Ramdisk should consider the size unit inspecting the RAM memory
+ Ramdisk should consider the size unit when inspecting the amount of RAM
Brad Lodgen (lodgenbd)
Changed in ironic-inspector:
assignee: nobody → Brad Lodgen (lodgenbd)
Brad Lodgen (lodgenbd)
Changed in ironic-inspector:
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Dmitry Tantsur (divius) wrote :

> Also, instead of using dmidecode we could look at use /proc/meminfo instead.

No, we can't. Otherwise good catch!

Changed in ironic-inspector:
importance: Undecided → High
Revision history for this message
Dmitry Tantsur (divius) wrote :

Oh, it should be fixed in diskimage-builder instead

Changed in ironic-inspector:
status: In Progress → Invalid
Revision history for this message
Lucas Alvares Gomes (lucasagomes) wrote :

Oh yeah, sorry should have opened against DIB

Revision history for this message
Brad Lodgen (lodgenbd) wrote :

Dmitry, for my own education, can you explain why dmidecode is required and /proc/meminfo cannot be used? Appreciate your help!

Changed in diskimage-builder:
status: New → Confirmed
assignee: nobody → Brad Lodgen (lodgenbd)
status: Confirmed → In Progress
Revision history for this message
Dmitry Tantsur (divius) wrote :

Everything except for dmidecode provides memory size available for operating system, which is real memory size - reserved kernel space. E.g. my laptop has 12288 MB (12 GB), meminfo shows 11998396 KB = 11717 MB.

Changed in diskimage-builder:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to diskimage-builder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/258757

Changed in diskimage-builder:
assignee: Brad Lodgen (lodgenbd) → Joey D. (jobewan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to diskimage-builder (master)

Reviewed: https://review.openstack.org/258757
Committed: https://git.openstack.org/cgit/openstack/diskimage-builder/commit/?id=802f14862cf46553c5ca5ce08d6ac8731aa01188
Submitter: Jenkins
Branch: master

commit 802f14862cf46553c5ca5ce08d6ac8731aa01188
Author: Joey D <email address hidden>
Date: Wed Dec 16 20:05:29 2015 -0600

    Fix discoverd bug when dmidecode reports GB

    This fix uses dmidecode and awk to simply multiply by 1024 when
    the value is represented in GB, otherwise it returns the given
    value. I should note that I've only observered this occurence
    on "some" SuperMicro Hardware

    Closes-Bug: #1486689

    Change-Id: I352b1891326f72af3a56c7bbe8b7f3c422169404

Changed in diskimage-builder:
status: In Progress → Fix Released
Revision history for this message
Dmitry Tantsur (divius) wrote :

The patch above broke ironic-inspector gate, so we have to revert it, sorry. I would suggest everyone struggling from this problem to check out ironic-python-agent. It can be used as a drop-in replacement for the old ramdisk.

Changed in diskimage-builder:
status: Fix Released → Confirmed
status: Confirmed → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.