1 Rookie
•
7 Posts
0
84
Use Redfish to change RaidStatus of a physical disk
Hi,
NVME's in a new r660xs with H965i controller are delivered with those NVME's set to "Non-RAID":
I don't know why this is, but I need to create a RAID array on this server and to achieve that, I need to manually configure each disk to RAID, which takes 3 minutes per disk and a lot of clicking as each change results in a "job". While that runs, the other disk pull down menu's are greyed out....
We like to configure our servers using Redfish and I fail to find how I can change this setting on a disk. What worries me is that in documentation I read that this is GET and the setting is readonly. I find it hard to believe that there is no way to configure this using RedFish.
Who knows what I can do?
I stubbornly tried to write some code using Python Redfish and it shows no error:
# I have these two functions:def get_disks(self):response = wait_until(lambda: self.rf_session.conn.get(f'/redfish/v1/Systems/System.Embedded.1/Storage/{self.get_raid_controller()}'),lambda x: len(x.dict.get('Drives')) >= 1)disks = []for drive in response.dict.get('Drives'):properties = self.rf_session.conn.get(drive.get('@odata.id')).dictdisks.append({'DiskID': properties.get('Id'),'Name': properties.get('MediaType') + ':' + re.findall(r'\d:\d:\d', properties.get('Name'))[0],'PartNumber': properties.get('Model'),'SerialNumber': properties.get('SerialNumber'),'Size': f"{int(round(float(properties.get('CapacityBytes'))/1000000000))} GB",'RaidStatus': properties.get('Oem', {}).get('Dell', {}).get('DellPhysicalDisk', {}).get('RaidStatus')})sorted_disks = sorted(disks, key=lambda d: d['DiskID'])return sorted_disksdef change_physical_disk_raid_status(self, disk):disk_id = disk['DiskID']update_url = f"/redfish/v1/Systems/System.Embedded.1/Storage/{self.get_raid_controller()}/Drives/{disk_id}/Oem/Dell/DellDrives/{disk_id}"payload = {'RaidStatus': 'Ready'}self.rf_session.conn.patch(update_url, body=payload)print(f"Updated {disk_id} RaidStatus to Ready")# I left out the get_raid_controller_name function and a lot of other, this is how I use these functions:raid_controller_name = bmc.get_raid_controller_name()if raid_controller_name == 'PERC H965i Front':print(f' - {raid_controller_name} found, check if the disks are configured as RAID or not')for disk in physical_disks:if disk['RaidStatus'] != 'Ready':print(f" - Changing {disk['Name']} which is {disk['RaidStatus']}")bmc.change_physical_disk_raid_status(disk)
When I execute this against the Redfish API on the server from which I took the above screenshot (with only disk 7 in Non-RAID status, I mean):
Collect the physical disks from the device.For max 600 seconds check every 30 seconds until '<function dell.get_disks.<locals>.<lambda> at 0x7f71ae9c3240>' equals <function dell.get_disks.<locals>.<lambda> at 0x7f71ae9c1bc0>Try number: 0...Check virtual disks:- Check RAID controller- PERC H965i Front found, check if the disks are configured as RAID or not- Changing SSD:0:1:7 which is NonRAIDUpdated Disk.Bay.7:Enclosure.Internal.0-1:RAID.SL.5-1 RaidStatus to Ready
Now, I don't check `response` for the status code, but the fact it doesn't break surprises me as I normally run into "this variable can't be set" or whatever the exact error message is when I throw whatever patch at the wrong place. I expected that this object would return something similar.
Anyway, I don't really care about a missing error, but the setting isn't updated when I run this... So, does anyone know how I can automate this?
DELL-Charles R
Moderator
Moderator
•
3.8K Posts
1
July 9th, 2024 17:45
Hello,
I'm not too familiar with scripting Redfish.
I did find this. Maybe it could work for you:
https://dell.to/3VXrUij
- name: Convert physical disk to RAID
dellemc.openmanage.idrac_redfish_storage_controller:
baseuri: "192.168.0.1:443"
username: "user_name"
password: "user_password"
ca_path: "/path/to/ca_cert.pem"
command: "ConvertToRAID"
target: "Disk.Bay.0:Enclosure.Internal.0-1:RAID.Slot.1-1"
tags:
- convert-raid
RealBOFH
1 Rookie
1 Rookie
•
7 Posts
0
July 9th, 2024 13:50
This code uses it:
When I execute this against the Redfish API on the server from which I took the above screenshot (with only disk 7 in Non-RAID status, I mean):
RealBOFH
1 Rookie
1 Rookie
•
7 Posts
0
July 10th, 2024 12:31
@DELL-Charles R Thanks! That is indeed the solution. I was made aware of this documentation about the ConvertToRAID action in RedFish, which does the task as I need it.
For those who wonder how to use it:
And in case you wonder, here's the check_job_status function:
(edited)