Overly strict error reporting for parsing dmidecode output

Bug #1521202 reported by Dmitry Tantsur
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironic-python-agent
Fix Released
Low
Trevor McCasland

Bug Description

Currently we issue ERROR-level messages when we can't parse "Size" expression in the dmidecode output: https://github.com/openstack/ironic-python-agent/blob/master/ironic_python_agent/hardware.py#L417-L422.

However, things like

 Size: No Module Installed

are pretty common and completely normal. Currently they cause a confusing error message. I suggest we lower this message to a warning, and maybe filter out common strings (like above).

Dmitry Tantsur (divius)
description: updated
Revision history for this message
Jacek Tomasiak (skazi) wrote :

IMHO the parsing code should be reworked completely.

On one of my machines, "dmidecode --type memory | grep Size" returns:
        Maximum Memory Module Size: 4096 MB
        Maximum Total Memory Size: 8192 MB
        Installed Size: 2048 MB (Double-bank Connection)
        Enabled Size: 2048 MB (Double-bank Connection)
        Installed Size: 2048 MB (Double-bank Connection)
        Enabled Size: 2048 MB (Double-bank Connection)
        Size: 2048 MB
        Size: 2048 MB

First six lines cause parsing errors as current implementation simply strips first token from the left and tries to parse the rest as size value.

On another one I get:
        Installed Size: Not Installed
        Enabled Size: Not Installed
        Installed Size: 1024 MB (Double-bank Connection)
        Enabled Size: 1024 MB (Double-bank Connection)
        Size: No Module Installed
        Size: 1024 MB

Which hits the "No Module Installed" case you mentioned.

I'd change it so, that the ones with names other than "Size" (e.g. Enabled Size or Installed Size) would be skipped silently and the ones with "No Module Installed" would be reported as warning at most.

Changed in ironic-python-agent:
assignee: nobody → Trevor McCasland (twm2016)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (master)

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

Changed in ironic-python-agent:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (master)

Reviewed: https://review.openstack.org/280970
Committed: https://git.openstack.org/cgit/openstack/ironic-python-agent/commit/?id=d66fa523bf400e53190da5e93a95771877885ac7
Submitter: Jenkins
Branch: master

commit d66fa523bf400e53190da5e93a95771877885ac7
Author: twm2016 <email address hidden>
Date: Tue Feb 16 16:41:46 2016 -0600

    Reduced restriction of parsing for dmidecode output

    Changed implementation to strip tokens up until the first 'Size: '
    string. This will allow for less parsing errors in the first
    six lines of the following output:
    "dmidecode --type 17 | grep Size" returns:
            Maximum Memory Module Size: 4096 MB
            Maximum Total Memory Size: 8192 MB
            Size: 2048 MB
            Size: 2048 MB

    Added a condition in the exception handling to address the
    issue of the bug on other outputs like:
            Installed Size: Not Installed
            Enabled Size: Not Installed
            Size: No Module Installed
            Size: 1024 MB

    Common strings like "No Module Installed" and "Not Installed" are
    normal. These two strings are hard coded in the before mentioned
    comparison and when found are logged as warnings instead of errors.

    Change-Id: If3475afcebfc7af7e9256b99924919557c4d909c
    Closes-Bug: #1521202

Changed in ironic-python-agent:
status: In Progress → Fix Released
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/ironic-python-agent 1.2.0

This issue was fixed in the openstack/ironic-python-agent 1.2.0 release.

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.