ipmi: Ignore sensor debug data

When the conductor has debugging enabled, that command is
passed to ipmitool to enable debugging of other commands.

However, this means tons of extra data is dumped as part of
the sensor data collection for ironic, which breaks string
parsing and ultimately metrics collection.

Since we can identify these lines, lets ignore them.

Change-Id: Ife77707210f8289d8f2e0223fb9ee1909d798546
Story: 2005332
Task: 30267
This commit is contained in:
Julia Kreger 2019-03-29 10:34:40 -07:00
parent c4ac28dff0
commit 418a5668a4
3 changed files with 87 additions and 0 deletions

View File

@ -660,6 +660,9 @@ def _process_sensor(sensor_data):
for field in sensor_data_fields:
if not field:
continue
if field.startswith('<<'):
# This is debug data, and can be safely ignored for this.
continue
kv_value = field.split(':')
if len(kv_value) != 2:
continue

View File

@ -2404,6 +2404,80 @@ class IPMIToolDriverTestCase(Base):
self.assertEqual(expected_return, ret)
def test__parse_ipmi_sensor_data_debug(self):
fake_sensors_data = """
<< Message tag : 0x00
<< RMCP+ status : no errors
<< Maximum privilege level : admin
<< Console Session ID : 0xa0a2a3a4
<< BMC Session ID : 0x02006a01
<< Negotiated authenticatin algorithm : hmac_sha1
<< Negotiated integrity algorithm : hmac_sha1_96
<< Negotiated encryption algorithm : aes_cbc_128
Sensor ID : Temp (0x2)
Entity ID : 3.2 (Processor)
Sensor Type (Analog) : Temperature
Sensor Reading : 50 (+/- 1) degrees C
Status : ok
Nominal Reading : 50.000
Normal Minimum : 11.000
Normal Maximum : 69.000
Upper critical : 90.000
Upper non-critical : 85.000
Positive Hysteresis : 1.000
Negative Hysteresis : 1.000
Sensor ID : FAN MOD 1A RPM (0x30)
Entity ID : 7.1 (System Board)
Sensor Type (Analog) : Fan
Sensor Reading : 8400 (+/- 75) RPM
Status : ok
Nominal Reading : 5325.000
Normal Minimum : 10425.000
Normal Maximum : 14775.000
Lower critical : 4275.000
Positive Hysteresis : 375.000
Negative Hysteresis : 375.000
"""
expected_return = {
'Fan': {
'FAN MOD 1A RPM (0x30)': {
'Status': 'ok',
'Sensor Reading': '8400 (+/- 75) RPM',
'Entity ID': '7.1 (System Board)',
'Normal Minimum': '10425.000',
'Positive Hysteresis': '375.000',
'Normal Maximum': '14775.000',
'Sensor Type (Analog)': 'Fan',
'Lower critical': '4275.000',
'Negative Hysteresis': '375.000',
'Sensor ID': 'FAN MOD 1A RPM (0x30)',
'Nominal Reading': '5325.000'
}
},
'Temperature': {
'Temp (0x2)': {
'Status': 'ok',
'Sensor Reading': '50 (+/- 1) degrees C',
'Entity ID': '3.2 (Processor)',
'Normal Minimum': '11.000',
'Positive Hysteresis': '1.000',
'Upper non-critical': '85.000',
'Normal Maximum': '69.000',
'Sensor Type (Analog)': 'Temperature',
'Negative Hysteresis': '1.000',
'Upper critical': '90.000',
'Sensor ID': 'Temp (0x2)',
'Nominal Reading': '50.000'
}
}
}
ret = ipmi._parse_ipmi_sensors_data(self.node, fake_sensors_data)
self.assertEqual(expected_return, ret)
def test__parse_ipmi_sensor_data_failed(self):
fake_sensors_data = "abcdef"
self.assertRaises(exception.FailedToParseSensorData,

View File

@ -0,0 +1,10 @@
---
fixes:
- |
Fixes an issue where the sensor data parsing method for the ``ipmitool``
interface lacked the ability to handle the automatically included
`ipmitool` debugging information when the ``debug`` option is set to
``True`` in the ironic.conf file. As such, extra debugging information
supplied by the underlying ``ipmitool`` command is disregarded.
More information can be found in
`story 2005331 <https://storyboard.openstack.org/#!/story/2005332>`_.