Browse Source

Added ``bus`` attribute to PhysicalDisks for NVMe drives

This patch adds `bus` attribute to PhysicalDisks so clients
can determine the PCI bus ID of NVMe drives.

Change-Id: I9b6b88826b9902a059e1bf537e51d9f97c9389ba
changes/38/707138/2
Rachit7194 1 week ago
parent
commit
719a7d81f8
3 changed files with 24 additions and 10 deletions
  1. +9
    -3
      dracclient/resources/raid.py
  2. +14
    -7
      dracclient/tests/test_raid.py
  3. +1
    -0
      dracclient/tests/wsman_mocks/physical_disk_view-enum-ok.xml

+ 9
- 3
dracclient/resources/raid.py View File

@@ -82,7 +82,7 @@ PhysicalDisk = collections.namedtuple(
['id', 'description', 'controller', 'manufacturer', 'model', 'media_type',
'interface_type', 'size_mb', 'free_size_mb', 'serial_number',
'firmware_version', 'status', 'raid_status', 'sas_address',
'device_protocol'])
'device_protocol', 'bus'])

RAIDController = collections.namedtuple(
'RAIDController', ['id', 'description', 'manufacturer', 'model',
@@ -141,7 +141,7 @@ class RAIDManagement(object):
'PrimaryStatus')],
firmware_version=self._get_raid_controller_attr(
drac_controller, 'ControllerFirmwareVersion'),
bus=self._get_raid_controller_attr(drac_controller, 'Bus'),
bus=self._get_raid_controller_attr(drac_controller, 'Bus').upper(),
supports_realtime=RAID_CONTROLLER_IS_REALTIME[
self._get_raid_controller_attr(
drac_controller, 'RealtimeCapability')])
@@ -266,6 +266,11 @@ class RAIDManagement(object):
uri)
drac_bus_protocol = self._get_physical_disk_attr(drac_disk,
'BusProtocol', uri)
bus = self._get_physical_disk_attr(drac_disk,
'Bus', uri, allow_missing=True)

if bus is not None:
bus = bus.upper()

return PhysicalDisk(
id=fqdd,
@@ -291,7 +296,8 @@ class RAIDManagement(object):
device_protocol=self._get_physical_disk_attr(drac_disk,
'DeviceProtocol',
uri,
allow_missing=True))
allow_missing=True),
bus=bus)

def _get_physical_disk_attr(self, drac_disk, attr_name, uri,
allow_missing=False):

+ 14
- 7
dracclient/tests/test_raid.py View File

@@ -60,7 +60,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='ok',
raid_status='ready',
sas_address='500056B37789ABE3',
device_protocol=None)
device_protocol=None,
bus=None)

self.disk_2 = raid.PhysicalDisk(
id='Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1',
@@ -77,7 +78,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='online',
raid_status='ready',
sas_address='500056B37789ABE3',
device_protocol=None)
device_protocol=None,
bus=None)

self.disk_3 = raid.PhysicalDisk(
id='Disk.Bay.0:Enclosure.Internal.0-1:AHCI.Integrated.1-1',
@@ -94,7 +96,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='online',
raid_status='ready',
sas_address='500056B37789ABE3',
device_protocol=None)
device_protocol=None,
bus=None)

self.disk_4 = raid.PhysicalDisk(
id='Disk.Bay.1:Enclosure.Internal.0-1:AHCI.Integrated.1-1',
@@ -111,7 +114,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='online',
raid_status='ready',
sas_address='500056B37789ABE3',
device_protocol=None)
device_protocol=None,
bus=None)

@mock.patch.object(dracclient.client.WSManClient,
'wait_until_idrac_is_ready', spec_set=True,
@@ -214,7 +218,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='ok',
raid_status='ready',
sas_address='5000C5007764F409',
device_protocol=None)
device_protocol=None,
bus=None)

mock_requests.post(
'https://1.2.3.4:443/wsman',
@@ -244,7 +249,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='ok',
raid_status='ready',
sas_address='5000C5007764F409',
device_protocol=None)
device_protocol=None,
bus=None)

mock_requests.post(
'https://1.2.3.4:443/wsman',
@@ -273,7 +279,8 @@ class ClientRAIDManagementTestCase(base.BaseTest):
status='unknown',
raid_status=None,
sas_address=None,
device_protocol='NVMe-MI1.0')
device_protocol='NVMe-MI1.0',
bus='3E')

mock_requests.post(
'https://1.2.3.4:443/wsman',

+ 1
- 0
dracclient/tests/wsman_mocks/physical_disk_view-enum-ok.xml View File

@@ -201,6 +201,7 @@
</n1:DCIM_PhysicalDiskView>
<n2:DCIM_PCIeSSDView>
<n2:BusProtocol>7</n2:BusProtocol>
<n2:Bus>3E</n2:Bus>
<n2:DeviceDescription>PCIe SSD in Slot 20 in Bay 1</n2:DeviceDescription>
<n2:DeviceProtocol>NVMe-MI1.0</n2:DeviceProtocol>
<n2:DriveFormFactor>2</n2:DriveFormFactor>

Loading…
Cancel
Save