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

Switching the storage controller from PERC to HBA and vice-versa #283

Closed EajksEajks closed 4 months ago

EajksEajks commented 4 months ago

Hi.

Is it possible using Redfish and iDRAC to change the storage controller mode from HBA to PERC and vice-versa (I have an R640 with an H330 mini PERC) ? If yes is it supported by the Python package? I don't see anything related to it.

Thanks for any help.

texroemer commented 4 months ago

Hi @EajksEajks

Yes you can use Redfish to change controller mode for PERC 9 controller. Script currently did not exist to cover this workflow so i created one, see example below running the script.

  1. First i'll get controller FQDDs for my server.
C:\Python310>python ChangeControllerModePerc9REDFISH.py -ip 192.168.0.120 -u root -p calvin --get-controllers

- Server controller(s) detected -

RAID.Mezzanine.1-1
AHCI.Embedded.1-1
AHCI.Embedded.2-1
  1. Using PERC 9 controller i'll get current controller mode which is RAID.
C:\Python310>python ChangeControllerModePerc9REDFISH.py -ip 192.168.0.120 -u root -p calvin --get-controller-mode RAID.Mezzanine.1-1

- Controller RAID.Mezzanine.1-1 current mode: RAID
  1. Using PERC 9 controller FQDD i'll change controller mode to HBA.
C:\Python310>python ChangeControllerModePerc9REDFISH.py -ip 192.168.0.120 -u root -p HBA --change-controller-mode RAID.Mezzanine.1-1 --mode HBA --reboot

- PASS: PATCH command passed to change controller RAID.Mezzanine.1-1 boot mode to HBA
- PASS, config job ID JID_084614359773 successfully created
- INFO, Current server power state is: On
- PASS, POST command passed to gracefully power OFF server
- INFO, script will now verify the server was able to perform a graceful shutdown. If the server was unable to perform a graceful shutdown, forced shutdown will be invoked in 5 minutes
- PASS, GET command passed to verify graceful shutdown was successful and server is in OFF state
- PASS, POST command passed to power ON server
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- INFO, job status not completed, current status: "Task successfully scheduled"
- 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"
- 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_084614359773')
('@odata.type', '#DellJob.v1_5_0.DellJob')
('ActualRunningStartTime', '2024-02-20T14:40:02')
('ActualRunningStopTime', '2024-02-20T14:41:46')
('CompletionTime', '2024-02-20T14:41:46')
('Description', 'Job Instance')
('EndTime', 'TIME_NA')
('Id', 'JID_084614359773')
('JobState', 'Completed')
('JobType', 'RAIDConfiguration')
('Message', 'Job completed successfully.')
('MessageArgs', [])
('MessageArgs@odata.count', 0)
('MessageId', 'PR19')
('Name', 'Configure: RAID.Mezzanine.1-1')
('PercentComplete', 100)
('StartTime', '2024-02-20T14:37:15')
('TargetSettingsURI', None)

- PASS, confirmed controller RAID.Mezzanine.1-1 mode successfully set to HBA

Thanks Tex

EajksEajks commented 4 months ago

Thanks a lot for your quick reply. It looks like what I was looking for.

texroemer commented 4 months ago

No problem, let me know if you hit any issues.

Thanks Tex