Merge "Failure in get_sensor_data() of 'redfish' management interface"

This commit is contained in:
Zuul 2019-07-17 11:23:10 +00:00 committed by Gerrit Code Review
commit 0f3476a4be
2 changed files with 7 additions and 8 deletions

View File

@ -239,7 +239,7 @@ class RedfishManagement(base.ManagementInterface):
""" """
sensors = {} sensors = {}
for fan in chassis.thermal.fans.get_members(): for fan in chassis.thermal.fans:
sensor = cls._sensor2dict( sensor = cls._sensor2dict(
fan, 'identity', 'max_reading_range', fan, 'identity', 'max_reading_range',
'min_reading_range', 'reading', 'reading_units', 'min_reading_range', 'reading', 'reading_units',
@ -259,7 +259,7 @@ class RedfishManagement(base.ManagementInterface):
""" """
sensors = {} sensors = {}
for temps in chassis.thermal.temperatures.get_members(): for temps in chassis.thermal.temperatures:
sensor = cls._sensor2dict( sensor = cls._sensor2dict(
temps, 'identity', 'max_reading_range_temp', temps, 'identity', 'max_reading_range_temp',
'min_reading_range_temp', 'reading_celsius', 'min_reading_range_temp', 'reading_celsius',
@ -290,7 +290,7 @@ class RedfishManagement(base.ManagementInterface):
'maximum_voltage', 'minimum_frequency_hz', 'maximum_voltage', 'minimum_frequency_hz',
'maximum_frequency_hz', 'output_wattage')) 'maximum_frequency_hz', 'output_wattage'))
unique_name = '%s:%s@%s' % ( unique_name = '%s:%s@%s' % (
power.member_id, chassis.power.identity, power.identity, chassis.power.identity,
chassis.identity) chassis.identity)
sensors[unique_name] = sensor sensors[unique_name] = sensor

View File

@ -234,11 +234,10 @@ class RedfishManagementTestCase(db_base.DbTestCase):
mock_chassis = mock.MagicMock(identity='ZZZ-YYY-XXX') mock_chassis = mock.MagicMock(identity='ZZZ-YYY-XXX')
mock_fans = mock_chassis.thermal.fans
mock_fan = mock.MagicMock(**attributes) mock_fan = mock.MagicMock(**attributes)
mock_fan.name = attributes['name'] mock_fan.name = attributes['name']
mock_fan.status = mock.MagicMock(**attributes['status']) mock_fan.status = mock.MagicMock(**attributes['status'])
mock_fans.get_members.return_value = [mock_fan] mock_chassis.thermal.fans = [mock_fan]
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
@ -279,11 +278,11 @@ class RedfishManagementTestCase(db_base.DbTestCase):
} }
mock_chassis = mock.MagicMock(identity='ZZZ-YYY-XXX') mock_chassis = mock.MagicMock(identity='ZZZ-YYY-XXX')
mock_temperatures = mock_chassis.thermal.temperatures
mock_temperature = mock.MagicMock(**attributes) mock_temperature = mock.MagicMock(**attributes)
mock_temperature.name = attributes['name'] mock_temperature.name = attributes['name']
mock_temperature.status = mock.MagicMock(**attributes['status']) mock_temperature.status = mock.MagicMock(**attributes['status'])
mock_temperatures.get_members.return_value = [mock_temperature] mock_chassis.thermal.temperatures = [mock_temperature]
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
@ -307,7 +306,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
def test__get_sensors_power(self): def test__get_sensors_power(self):
attributes = { attributes = {
'member_id': 0, 'identity': 0,
'name': 'Power Supply 0', 'name': 'Power Supply 0',
'power_capacity_watts': 1450, 'power_capacity_watts': 1450,
'last_power_output_watts': 650, 'last_power_output_watts': 650,