Quellcode durchsuchen

SSC.disks_sizes_bytes handle CapacityBytes is None

In the open ocean, a Redfish service can return a SimpleStorage resource
containing a Device property with its CapacityBytes property set to
null. According to the Distributed Management Task Force (DMTF) schema
for SimpleStorage, the type of CapacityBytes can be either integer or
null [1].

The Dell integrated Dell Remote Access Controller (iDRAC) 9 running
Lifecycle Controller firmware version 3.30.30.30 returns that for a Dell
EMC PowerEdge R740xd containing a Dell HBA 330 12Gbps SAS Host Bus
Adapter Controller (non-RAID), MiniCard (HBA 330 Mini) [2]. The HBA 330
Mini firmware version is 16.17.00.03.

The same was observed against an R740xd running Lifecycle Controller
firmware version 3.34.34.34.

This changes the SimpleStorageCollection.disks_size_bytes property to
process only Disks with CapacityByes not set to None.

[1] https://redfish.dmtf.org/schemas/SimpleStorage.v1_2_3.json
[2] http://eavesdrop.openstack.org/irclogs/%23openstack-ironic/%23openstack-ironic.2019-12-11.log.html#t2019-12-11T07:24:17

Change-Id: I57a0074a7f6c4495e7c73a00c87675ea87fdb6e8
Story: 2006918
Task: 37567
(cherry picked from commit 9d01756833ec97a05f301a4fa1e8b2511d7c5c74)
tags/1.8.2^0
Richard Pioso vor 3 Monaten
Ursprung
Commit
e6378be799
3 geänderte Dateien mit 26 neuen und 1 gelöschten Zeilen
  1. +11
    -0
      releasenotes/notes/fix-simple-storage-device-capacity-bytes-null-0672eed36d9da70a.yaml
  2. +2
    -1
      sushy/resources/system/simple_storage.py
  3. +13
    -0
      sushy/tests/unit/resources/system/test_simple_storage.py

+ 11
- 0
releasenotes/notes/fix-simple-storage-device-capacity-bytes-null-0672eed36d9da70a.yaml Datei anzeigen

@@ -0,0 +1,11 @@
---
fixes:
- |
Fixes bug in ``SimpleStorageCollection.disks_sizes_bytes`` which assumed
the type of a disk's ``CapacityBytes`` property is ``integer``. According
to the Distributed Management Task Force (DMTF) Redfish standard schema
[1], it can be ``null``, which is converted to ``None`` in Python. For
more information, see `story 2006918
<https://storyboard.openstack.org/#!/story/2006918>`_.

[1] https://redfish.dmtf.org/schemas/SimpleStorage.v1_2_3.json

+ 2
- 1
sushy/resources/system/simple_storage.py Datei anzeigen

@@ -73,7 +73,8 @@ class SimpleStorageCollection(base.ResourceCollectionBase):
return sorted(device.capacity_bytes
for simpl_stor in self.get_members()
for device in simpl_stor.devices
if device.status.state == res_cons.STATE_ENABLED)
if (device.status.state == res_cons.STATE_ENABLED
and device.capacity_bytes is not None))

@property
def max_size_bytes(self):


+ 13
- 0
sushy/tests/unit/resources/system/test_simple_storage.py Datei anzeigen

@@ -96,6 +96,19 @@ class SimpleStorageCollectionTestCase(base.TestCase):
self.assertEqual([4000000000000, 8000000000000],
self.simpl_stor_col.disks_sizes_bytes)

def test_disks_sizes_bytes_capacity_bytes_none(self):
self.conn.get.return_value.json.reset_mock()

with open('sushy/tests/unit/json_samples/'
'simple_storage.json') as f:
json_doc = json.load(f)

json_doc['Devices'][0]['CapacityBytes'] = None
self.conn.get.return_value.json.return_value = json_doc

self.assertEqual([4000000000000],
self.simpl_stor_col.disks_sizes_bytes)

def test_max_size_bytes(self):
self.conn.get.return_value.json.reset_mock()



Laden…
Abbrechen
Speichern