From a2ae57c457962e6fa5e590c0de19f4d457637881 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Fri, 27 Sep 2019 18:22:16 +0200 Subject: [PATCH] Fix drive sensors collection in `redfish` mgmt interface Fixes drive sensors information collection in `redfish` management interface. Prior to this fix, wrong Redfish schema has been used for Drive resource what has been causing exception and ultimately sensor data collection failure. Change-Id: I8b0f69d13420fa0a3fc21f044ed2bba6a540e638 --- ironic/drivers/modules/redfish/management.py | 6 ++---- .../unit/drivers/modules/redfish/test_management.py | 11 +++++------ .../notes/fix-sensors-storage-ed5d5bbda9b46645.yaml | 7 +++++++ 3 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/fix-sensors-storage-ed5d5bbda9b46645.yaml diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py index 97ffc2156f..f17f6c6545 100644 --- a/ironic/drivers/modules/redfish/management.py +++ b/ironic/drivers/modules/redfish/management.py @@ -308,13 +308,11 @@ class RedfishManagement(base.ManagementInterface): for storage in system.simple_storage.get_members(): for drive in storage.devices: sensor = cls._sensor2dict( - drive, 'identity', 'model', 'capacity_bytes', - 'failure_predicted') + drive, 'name', 'model', 'capacity_bytes') sensor.update( cls._sensor2dict(drive.status, 'state', 'health')) unique_name = '%s:%s@%s' % ( - drive.identity, system.simple_storage.identity, - system.identity) + drive.name, storage.identity, system.identity) sensors[unique_name] = sensor return sensors diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py index a4664f08f4..170557f28b 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_management.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py @@ -359,11 +359,10 @@ class RedfishManagementTestCase(db_base.DbTestCase): def test__get_sensors_data_drive(self): attributes = { - 'identity': '32ADF365C6C1B7BD', + 'name': '32ADF365C6C1B7BD', + 'manufacturer': 'IBM', 'model': 'IBM 350A', 'capacity_bytes': 3750000000, - 'failure_predicted': True, - 'serial_number': 'SN010203040506', 'status': { 'health': 'OK', 'state': 'enabled' @@ -372,10 +371,11 @@ class RedfishManagementTestCase(db_base.DbTestCase): mock_system = mock.MagicMock(identity='ZZZ-YYY-XXX') mock_drive = mock.MagicMock(**attributes) + mock_drive.name = attributes['name'] mock_drive.status = mock.MagicMock(**attributes['status']) mock_storage = mock.MagicMock() mock_storage.devices = [mock_drive] - mock_system.simple_storage.identity = 'XXX-YYY-ZZZ' + mock_storage.identity = 'XXX-YYY-ZZZ' mock_system.simple_storage.get_members.return_value = [mock_storage] with task_manager.acquire(self.context, self.node.uuid, @@ -385,9 +385,8 @@ class RedfishManagementTestCase(db_base.DbTestCase): expected = { '32ADF365C6C1B7BD:XXX-YYY-ZZZ@ZZZ-YYY-XXX': { 'capacity_bytes': 3750000000, - 'failure_predicted': True, 'health': 'OK', - 'identity': '32ADF365C6C1B7BD', + 'name': '32ADF365C6C1B7BD', 'model': 'IBM 350A', 'state': 'enabled' } diff --git a/releasenotes/notes/fix-sensors-storage-ed5d5bbda9b46645.yaml b/releasenotes/notes/fix-sensors-storage-ed5d5bbda9b46645.yaml new file mode 100644 index 0000000000..25b44555b0 --- /dev/null +++ b/releasenotes/notes/fix-sensors-storage-ed5d5bbda9b46645.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes drive sensors information collection in ``redfish`` management + interface. Prior to this fix, wrong Redfish schema has been used for + Drive resource what has been causing exception and ultimately sensor + data collection failure.