dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
584 stars 273 forks source link

Adding --check-disk flag and unity error exit code #278

Closed rounak-adhikary closed 5 months ago

rounak-adhikary commented 5 months ago
  1. Adding a new flag --check-disk to be used to check (only on iDRAC 9) if the disk supports secure erase without actually trying to erase it.
  2. Adding exit code as 1 in cases where there is a failure so that this script can be used in simple automations.

Tests

Successful secure erase

- PASS: POST command passed to secure erase device "Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1", status code 202 returned
- PASS, realtime jid "JID_075079596314" successfully created. Server will apply the configuration changes in real time, no server reboot needed
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"
- INFO, job status not completed, current status: "Job in progress"

--- PASS, Final Detailed Job Status Results ---

('@odata.context', '/redfish/v1/$metadata#DellJob.DellJob')
('@odata.id', '/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_075079596314')
('@odata.type', '#DellJob.v1_5_0.DellJob')
('ActualRunningStartTime', '2024-02-09T13:46:00')
('ActualRunningStopTime', '2024-02-09T13:47:21')
('CompletionTime', '2024-02-09T13:47:21')
('Description', 'Job Instance')
('EndTime', 'TIME_NA')
('Id', 'JID_075079596314')
('JobState', 'Completed')
('JobType', 'RealTimeNoRebootConfiguration')
('Message', 'Job completed successfully.')
('MessageArgs', [])
('MessageArgs@odata.count', 0)
('MessageId', 'PR19')
('Name', 'Configure: RAID.Integrated.1-1')
('PercentComplete', 100)
('StartTime', '2024-02-09T13:45:59')
('TargetSettingsURI', None)

Failed secure erase

- FAIL, POST command failed for secure erase, status code is 400

- POST command failure is:
{'error': {'@Message.ExtendedInfo': [{'Message': 'One or more storage device(s) are not in a state where the operation can be completed.', 'MessageArgs': [], 'MessageArgs@odata.count': 0, 'MessageId': 'IDRAC.2.8.STOR013', 'RelatedProperties': [], 'RelatedProperties@odata.count': 0, 'Resolution': 'Make sure the specified storage devices are in a state appropriate for the requested operation and retry the operation.', 'Severity': 'Warning'}], 'code': 'Base.1.12.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}}

Successful disk checks

- PASS, device Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1 supports secure erase