| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
GET_IDRAC_STORAGE_DETAILS_URI_10 = "/redfish/v1/Systems/System.Embedded.1/Storage" |
| 29 |
NA = "Not Available" |
| 30 |
|
| 31 |
|
| 32 |
class IDRACPhysicalDiskInfo(object): |
| 33 |
def __init__(self, idrac): |
| 34 |
self.idrac = idrac |
| 35 |
|
| 36 |
def physical_disk_mapped_data(self, disk): |
| 37 |
physical_disk_data = disk.get("Oem", {}).get("Dell", {}).get("DellPhysicalDisk", {}) |
| 38 |
output = { |
| 39 |
"BlockSize": str(disk.get("BlockSizeBytes", NA)), |
| 40 |
"BusProtocol": NA, |
| 41 |
"DeviceDescription": str(disk.get("Description", NA)), |
| 42 |
"DriveFormFactor": str(physical_disk_data.get("DriveFormFactor", NA)), |
| 43 |
"FQDD": str(disk.get("Id", NA)), |
| 44 |
"FreeSize": str(physical_disk_data.get("FreeSizeInBytes", NA)), |
| 45 |
"HotSpareStatus": NA, |
| 46 |
"Key": str(disk.get("Id", NA)), |
| 47 |
"Manufacturer": str(disk.get("Manufacturer", NA)), |
| 48 |
"ManufacturingDay": str(physical_disk_data.get("ManufacturingDay", NA)), |
| 49 |
"ManufacturingWeek": str(physical_disk_data.get("ManufacturingWeek", NA)), |
| 50 |
"ManufacturingYear": str(physical_disk_data.get("ManufacturingYear", NA)), |
| 51 |
"MaxCapableSpeed": str(disk.get("CapableSpeedGbs", NA)) + " Gbps", |
| 52 |
"MediaType": str(disk.get("MediaType", NA)), |
| 53 |
"Model": str(disk.get("Model", NA)), |
| 54 |
"PPID": str(physical_disk_data.get("PPID", NA)), |
| 55 |
"PredictiveFailureState": str(physical_disk_data.get("PredictiveFailureState", NA)), |
| 56 |
"PrimaryStatus": NA, |
| 57 |
"RAIDNegotiatedSpeed": str(disk.get("RotationSpeedRPM", NA)), |
| 58 |
"RaidStatus": str(physical_disk_data.get("RaidStatus", NA)), |
| 59 |
"RemainingRatedWriteEndurance": NA, |
| 60 |
"Revision": str(disk.get("Revision", NA)), |
| 61 |
"SASAddress": str(physical_disk_data.get("SASAddress", NA)), |
| 62 |
"SecurityState": NA, |
| 63 |
"SerialNumber": str(disk.get("SerialNumber", NA)), |
| 64 |
"Size": NA, |
| 65 |
"Slot": str(physical_disk_data.get("Slot", NA)), |
| 66 |
"SupportedEncryptionTypes": NA, |
| 67 |
"T10PICapability": str(physical_disk_data.get("T10PICapability", NA)), |
| 68 |
"UsedSize": str(physical_disk_data.get("UsedSizeInBytes", NA)), |
| 69 |
} |
| 70 |
return output |
| 71 |
|
| 72 |
def get_physical_disk_info(self): |
| 73 |
output = [] |
| 74 |
|
| 75 |
response = self.idrac.invoke_request(method='GET', uri=GET_IDRAC_STORAGE_DETAILS_URI_10) |
| 76 |
members = response.json_data.get("Members", []) |
| 77 |
|
| 78 |
for member in members: |
| 79 |
storage_uri = member.get("@odata.id") |
| 80 |
if not storage_uri: |
| 81 |
continue |
| 82 |
|
| 83 |
|
| 84 |
storage_resp = self.idrac.invoke_request(method='GET', uri=storage_uri) |
| 85 |
if storage_resp.status_code != 200: |
| 86 |
continue |
| 87 |
|
| 88 |
drives = storage_resp.json_data.get("Drives", []) |
| 89 |
for drive in drives: |
| 90 |
drive_uri = drive.get("@odata.id") |
| 91 |
if not drive_uri: |
| 92 |
continue |
| 93 |
|
| 94 |
drive_resp = self.idrac.invoke_request(method='GET', uri=drive_uri) |
| 95 |
if drive_resp.status_code == 200: |
| 96 |
output.append(self.physical_disk_mapped_data(drive_resp.json_data)) |
| 97 |
|
| 98 |
return output |