Permalink
Browse files

Don't assume FQDD naming

Splitting on fixed number of colons breaks in this case :

Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1
Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1
Disk.Bay.2:Enclosure.Internal.0-1:RAID.Integrated.1-1
Disk.Bay.3:Enclosure.Internal.0-1:RAID.Integrated.1-1
Disk.Direct.4:RAID.Integrated.1-1
Disk.Direct.5:RAID.Integrated.1-1

Split from right instead, doesn't fail

Partial-Bug: #1586545

Change-Id: Ib4ca517388c48ade321451cb8af07abb731e5940
  • Loading branch information...
anish committed Sep 29, 2016
1 parent 0cfeff4 commit af0894134fb210090120b3c62cbdde4a8d080939
@@ -222,7 +222,7 @@ def _parse_drac_virtual_disk(self, drac_disk):
name=self._get_virtual_disk_attr(drac_disk, 'Name'),
description=self._get_virtual_disk_attr(drac_disk,
'DeviceDescription'),
controller=fqdd.split(':')[1],
controller=fqdd.split(':')[-1],
raid_level=REVERSE_RAID_LEVELS[drac_raid_level],
size_mb=int(size_b) / 2 ** 20,
status=constants.PRIMARY_STATUS[drac_status],
@@ -273,7 +273,7 @@ def _parse_drac_physical_disk(self, drac_disk):
id=fqdd,
description=self._get_physical_disk_attr(drac_disk,
'DeviceDescription'),
controller=fqdd.split(':')[2],
controller=fqdd.split(':')[-1],
manufacturer=self._get_physical_disk_attr(drac_disk,
'Manufacturer'),
model=self._get_physical_disk_attr(drac_disk, 'Model'),
@@ -94,6 +94,30 @@ def test_list_physical_disks(self, mock_requests):
self.assertIn(expected_physical_disk,
self.drac_client.list_physical_disks())
def test_list_physical_disks_direct(self, mock_requests):
expected_physical_disk = raid.PhysicalDisk(
id='Disk.Direct.2:RAID.Integrated.1-1',
description=('Disk 2 on '
'Integrated RAID Controller 1'),
controller='RAID.Integrated.1-1',
manufacturer='ATA',
model='ST600MM0007',
media_type='ssd',
interface_type='sata',
size_mb=571776,
free_size_mb=571776,
serial_number='S0M3EY3Z',
firmware_version='LS0B',
status='ok',
raid_status='ready')
mock_requests.post(
'https://1.2.3.4:443/wsman',
text=test_utils.RAIDEnumerations[uris.DCIM_PhysicalDiskView]['ok'])
self.assertIn(expected_physical_disk,
self.drac_client.list_physical_disks())
# Verify that various client convert_physical_disks calls to dracclient
# result in a WSMan.invoke with appropriate parameters
def _random_term(self):
@@ -86,9 +86,46 @@
<n1:T10PICapability>0</n1:T10PICapability>
<n1:UsedSizeInBytes>0</n1:UsedSizeInBytes>
</n1:DCIM_PhysicalDiskView>
<n1:DCIM_PhysicalDiskView>
<n1:BlockSizeInBytes>512</n1:BlockSizeInBytes>
<n1:BusProtocol>5</n1:BusProtocol>
<n1:Connector>0</n1:Connector>
<n1:DeviceDescription>Disk 2 on Integrated RAID Controller 1</n1:DeviceDescription>
<n1:DriveFormFactor>2</n1:DriveFormFactor>
<n1:FQDD>Disk.Direct.2:RAID.Integrated.1-1</n1:FQDD>
<n1:FreeSizeInBytes>599550590976</n1:FreeSizeInBytes>
<n1:HotSpareStatus>0</n1:HotSpareStatus>
<n1:InstanceID>Disk.Direct.2:RAID.Integrated.1-1</n1:InstanceID>
<n1:LastSystemInventoryTime>20150226180025.000000+000</n1:LastSystemInventoryTime>
<n1:LastUpdateTime>20150226180025.000000+000</n1:LastUpdateTime>
<n1:Manufacturer>ATA </n1:Manufacturer>
<n1:ManufacturingDay>2</n1:ManufacturingDay>
<n1:ManufacturingWeek>33</n1:ManufacturingWeek>
<n1:ManufacturingYear>2014</n1:ManufacturingYear>
<n1:MaxCapableSpeed>3</n1:MaxCapableSpeed>
<n1:MediaType>1</n1:MediaType>
<n1:Model>ST600MM0007 </n1:Model>
<n1:OperationName>None</n1:OperationName>
<n1:OperationPercentComplete>0</n1:OperationPercentComplete>
<n1:PPID>CN07YX587262248G01PZA02 </n1:PPID>
<n1:PredictiveFailureState>0</n1:PredictiveFailureState>
<n1:PrimaryStatus>1</n1:PrimaryStatus>
<n1:RaidStatus>1</n1:RaidStatus>
<n1:RemainingRatedWriteEndurance>255</n1:RemainingRatedWriteEndurance>
<n1:Revision>LS0B</n1:Revision>
<n1:RollupStatus>1</n1:RollupStatus>
<n1:SASAddress>5000C5007764F409</n1:SASAddress>
<n1:SecurityState>0</n1:SecurityState>
<n1:SerialNumber>S0M3EY3Z </n1:SerialNumber>
<n1:SizeInBytes>599550590976</n1:SizeInBytes>
<n1:Slot>2</n1:Slot>
<n1:SupportedEncryptionTypes>None</n1:SupportedEncryptionTypes>
<n1:T10PICapability>0</n1:T10PICapability>
<n1:UsedSizeInBytes>0</n1:UsedSizeInBytes>
</n1:DCIM_PhysicalDiskView>
</wsman:Items>
<wsen:EnumerationContext/>
<wsman:EndOfSequence/>
</wsen:EnumerateResponse>
</s:Body>
</s:Envelope>
</s:Envelope>

0 comments on commit af08941

Please sign in to comment.