Fujitsu PRIMERGY: Configuring RAID via iRMC REST API

Fujitsu published iRMC S4 REST API. With the latest firmware (version 8.4x), you can configure RAID via API. That means you don't need to bring up the RAID configuration utility to create logical drives on a new machine, or you can manage the RAID card and logical drives even though ServerView RAID does not support the OS you are using. This feature is good to have so you can replicate the same configuration to multiple servers at the same time.

I will explain how to create/delete logical drive(s) via iRMC REST API. As a prerequisite, iRMC firmware must be at 8.4x or later.
In the following example, I will use iRMC user ID: admin, iRMC user password: admin, and iRMC IP address: 192.168.10.80.

  1. Check if the RAID profile is already there.
  2. $ curl -u admin:admin -H"Accept: application/json" -X GET -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/
    HTTP/1.1 200 OK
    Date: Fri, 28 Oct 2016 23:15:29 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:15:29 GMT
    Content-Length: 145
    Content-Type: application/json; charset=UTF-8
    
    {
      "Links":{
        "profileStore":[
          {
            "@odata.id":"rest\/v1\/Oem\/eLCM\/ProfileManagement\/HWConfigurationIrmc"
          }
        ]
      }
    }
    
    If the profile is not created yet, run the following to create it:
    $ curl -u admin:admin -H"Accept: application/json" -X POST -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/get?PARAM_PATH=Server/HWConfigurationIrmc
    HTTP/1.1 202 Accepted
    Date: Fri, 28 Oct 2016 22:57:05 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 22:57:05 GMT
    Content-Length: 154
    Content-Type: application/json; charset=UTF-8
    Location: rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc
    
    {
      "Session":{
        "Id":16,
        "Tag":"",
        "WorkSequence":"obtainProfileParameters",
        "Start":"",
        "Duration":0,
        "Status":"activated"
      }
    }
    
    
  3. Review the current configuration. The following example shows that there is one RAID card, and six physical SATA hard drives in slot 0, 1, 2, 4, 5, and 6 which are all 465GB drives. There is no logical drive configured.
  4. $ curl -u admin:admin -H"Accept: application/json" -X GET -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc
    HTTP/1.1 200 OK
    Date: Fri, 28 Oct 2016 23:00:40 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:00:40 GMT
    Content-Length: 3881
    Content-Type: application/json; charset=UTF-8
    Content-disposition: attachment; filename="rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc";
    
    {
      "Server":{
        "HWConfigurationIrmc":{
          "Adapters":{
            "RAIDAdapter":[
              {
                "@AdapterId":"RAIDAdapter0",
                "@ConfigurationType":"Addressing",
                "PCIId":{
                  "Vendor":"1000",
                  "Device":"005B",
                  "ControllerIndex":0
                },
                "Features":{
                  "RaidLevel":"0,1,5,6,10,50,60",
                  "Stripe":{
                    "@Unit":"KB",
                    "#text":"8,16,32,64,128,256,512,1024"
                  },
                  "InitMode":"no,fast,slow",
                  "WriteMode":"WriteBack,WriteThrough,AlwaysWriteBack",
                  "ReadMode":"NoReadAhead,ReadAhead",
                  "CacheMode":"Direct,Cached",
                  "DiskCacheMode":"Enabled,Disabled,Unchanged"
                },
                "BGIRate":30,
                "MDCRate":30,
                "RebuildRate":30,
                "EnableCopyback":"Enabled",
                "EnableCopybackOnSMART":"Enabled",
                "EnableCopybackOnSSDSMART":"Enabled",
                "AutoRebuild":"Enabled",
                "PhysicalDisks":{
                  "PhysicalDisk":[
                    {
                      "@Number":"0",
                      "@Action":"None",
                      "Slot":0,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"1",
                      "@Action":"None",
                      "Slot":1,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"2",
                      "@Action":"None",
                      "Slot":2,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"4",
                      "@Action":"None",
                      "Slot":4,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"5",
                      "@Action":"None",
                      "Slot":5,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"6",
                      "@Action":"None",
                      "Slot":6,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    }
                  ]
                },
                "Arrays":null,
                "LogicalDrives":null
              }
            ]
          }
        }
      }
    }
    
  5. Create logical drive(s). I will create one RAID1 volume with two HDDs, and one RAID5 volume with the remaining four HDDs. To do this, you need to create a configuration file to send to iRMC. Then send a request to iRMC to create volumes.
    If you want to specify drive slots for each logical volume, you can do that. Read the API manual for details.
  6. $ cat create_logical_drives.json
    {
      "Server":{
        "HWConfigurationIrmc":{
          "@Processing":"execute",
          "Adapters":{
            "RAIDAdapter":[
              {
                "@AdapterId":"RAIDAdapter0",
                "@ConfigurationType":"Addressing",
                "LogicalDrives":{
                  "LogicalDrive":[
                    {
                      "@Number":0,
                      "@Action":"Create",
                      "RaidLevel":"1"
                    },
                    {
                      "@Number":1,
                      "@Action":"Create",
                      "RaidLevel":"5"
                    }
                  ]
                },
              }
            ]
          },
          "@Version":"1.00"
        },
        "@Version":"1.01"
      }
    }
    
    $ curl -u admin:admin -H"Accept: application/json" -X POST -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/set --data @create_logical_drives.json
    HTTP/1.1 202 Accepted
    Date: Fri, 28 Oct 2016 23:29:20 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:29:20 GMT
    Content-Length: 143
    Content-Type: application/json; charset=UTF-8
    
    {
      "Session":{
        "Id":17,
        "Tag":"",
        "WorkSequence":"applyProfile",
        "Start":"",
        "Duration":0,
        "Status":"activated"
      }
    }
    
  7. Wait for the request to be completed.
  8. Check the current session status.
    $ curl -u admin:admin -H"Accept: application/json" -X GET -i http://192.168.10.80/sessionInformation/17/status
    HTTP/1.1 200 OK
    Date: Fri, 28 Oct 2016 23:36:16 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:36:16 GMT
    Content-Length: 177
    Content-Type: application/json; charset=UTF-8
    
    {
      "Session":{
        "Id":17,
        "Tag":"",
        "WorkSequence":"applyProfile",
        "Start":"2016\/10\/28 16:30:00",
        "Duration":145,
        "Status":"terminated regularly"
      }
    }
    
    Check the current log.
    $ curl -u admin:admin -H"Accept: application/json" -X GET -i http://192.168.10.80/sessionInformation/17/log
    HTTP/1.1 200 OK
    Date: Fri, 28 Oct 2016 23:36:20 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:36:20 GMT
    Content-Length: 2510
    Content-Type: application/json; charset=UTF-8
    Content-disposition: attachment; filename="sessionInformation/17/log";
    
    {
      "SessionLog":{
        "Id":17,
        "Tag":"",
        "WorkSequence":"applyProfile",
        "Entries":{
          "Entry":[
            {
              "@date":"2016\/10\/28 16:29:20",
              "#text":"CreateSession: Session 'applyProfile' created with id 17"
            },
            {
              "@date":"2016\/10\/28 16:29:20",
              "#text":"AttachWorkSequence: Attached work sequence 'applyProfile' to session 17"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"LCMScheduler: Launch ApplyProfileParameters"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ValidateProfile: Profile successfully validated"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ApplyProfileParameters: Sub profile 'BiosConfig' not found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ApplyProfileParameters: Sub profile 'IrmcConfig' not found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ApplyProfileParameters: Sub profile 'AdapterConfigIrmc' not found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ApplyProfileParameters: Sub profile 'OSInstallation' not found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"ApplyProfileParameters: Sub profile 'HWConfiguration' not found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"FindSubProfile: Sub profile 'HWConfigurationIrmc' found"
            },
            {
              "@date":"2016\/10\/28 16:30:00",
              "#text":"LOG-1-HWConfigurationIrmc: Start processing of Sub profile 'HWConfigurationIrmc'"
            },
            {
              "@date":"2016\/10\/28 16:32:14",
              "#text":"createLogicalDrive: drv[0] Create Drive [RAID Level = 1]"
            },
            {
              "@date":"2016\/10\/28 16:32:22",
              "#text":"createLogicalDrive: drv[1] Create Drive [RAID Level = 5]"
            },
            {
              "@date":"2016\/10\/28 16:32:25",
              "#text":"LOG-2-HWConfigurationIrmc-Success: Finished processing of Sub profile 'HWConfigurationIrmc' with status 'Success'"
            },
            {
              "@date":"2016\/10\/28 16:32:25",
              "#text":"LCMScheduler: LCM object is being destroyed as automatic termination was configured"
            },
            {
              "@date":"2016\/10\/28 16:32:25",
              "#text":"TerminateSession: 'applyProfile' is being terminated"
            }
          ]
        }
      }
    }
    
  9. Check if the logical drives are configured. You can see the status on iRMC Web GUI, or rescan the profile.
  10. Delete the current profile.
    $ curl -u admin:admin -H"Accept: application/json" -X DELETE -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc
    
    Rescan the configuration.
    $ curl -u admin:admin -H"Accept: application/json" -X POST -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/get?PARAM_PATH=Server/HWConfigurationIrmc
    
    View the latest profile. As you can see, logical drive 0 (RAID 1) and logical drive 1 (RAID 5) are newly created.
    $ curl -u admin:admin -H"Accept: application/json" -X GET -i http://192.168.10.80/rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc
    HTTP/1.1 200 OK
    Date: Fri, 28 Oct 2016 23:51:08 GMT
    Server: iRMC S4 Webserver
    Expires: Thu, 27 Oct 2016 23:51:08 GMT
    Content-Length: 6625
    Content-Type: application/json; charset=UTF-8
    Content-disposition: attachment; filename="rest/v1/Oem/eLCM/ProfileManagement/HWConfigurationIrmc";
    
    {
      "Server":{
        "HWConfigurationIrmc":{
          "Adapters":{
            "RAIDAdapter":[
              {
                "@AdapterId":"RAIDAdapter0",
                "@ConfigurationType":"Addressing",
                "PCIId":{
                  "Vendor":"1000",
                  "Device":"005B",
                  "ControllerIndex":0
                },
                "Features":{
                  "RaidLevel":"0,1,5,6,10,50,60",
                  "Stripe":{
                    "@Unit":"KB",
                    "#text":"8,16,32,64,128,256,512,1024"
                  },
                  "InitMode":"no,fast,slow",
                  "WriteMode":"WriteBack,WriteThrough,AlwaysWriteBack",
                  "ReadMode":"NoReadAhead,ReadAhead",
                  "CacheMode":"Direct,Cached",
                  "DiskCacheMode":"Enabled,Disabled,Unchanged"
                },
                "BGIRate":30,
                "MDCRate":30,
                "RebuildRate":30,
                "EnableCopyback":"Enabled",
                "EnableCopybackOnSMART":"Enabled",
                "EnableCopybackOnSSDSMART":"Enabled",
                "AutoRebuild":"Enabled",
                "Arrays":{
                  "Array":[
                    {
                      "@Number":0,
                      "@ConfigurationType":"Addressing",
                      "PhysicalDiskRefs":{
                        "PhysicalDiskRef":[
                          {
                            "@Number":"0"
                          },
                          {
                            "@Number":"1"
                          }
                        ]
                      }
                    },
                    {
                      "@Number":1,
                      "@ConfigurationType":"Addressing",
                      "PhysicalDiskRefs":{
                        "PhysicalDiskRef":[
                          {
                            "@Number":"2"
                          },
                          {
                            "@Number":"4"
                          },
                          {
                            "@Number":"5"
                          }
                        ]
                      }
                    }
                  ]
                },
                "LogicalDrives":{
                  "LogicalDrive":[
                    {
                      "@Number":0,
                      "@Action":"None",
                      "RaidLevel":"1",
                      "ArrayRefs":{
                        "ArrayRef":[
                          {
                            "@Number":0
                          }
                        ]
                      },
                      "WriteMode":"WriteThrough",
                      "ReadMode":"ReadAhead",
                      "CacheMode":"Direct",
                      "DiskCacheMode":"Disabled",
                      "Stripe":{
                        "@Unit":"KB",
                        "#text":64
                      },
                      "InitMode":"no",
                      "LDStatus":"Operational",
                      "Name":"LogicalDrive_0",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":1,
                      "@Action":"None",
                      "RaidLevel":"5",
                      "ArrayRefs":{
                        "ArrayRef":[
                          {
                            "@Number":1
                          }
                        ]
                      },
                      "WriteMode":"WriteThrough",
                      "ReadMode":"ReadAhead",
                      "CacheMode":"Direct",
                      "DiskCacheMode":"Disabled",
                      "Stripe":{
                        "@Unit":"KB",
                        "#text":64
                      },
                      "InitMode":"no",
                      "LDStatus":"Operational",
                      "Name":"LogicalDrive_1",
                      "Size":{
                        "@Unit":"GB",
                        "#text":930
                      }
                    }
                  ]
                },
                "PhysicalDisks":{
                  "PhysicalDisk":[
                    {
                      "@Number":"0",
                      "@Action":"None",
                      "Slot":0,
                      "PDStatus":"Operational",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"1",
                      "@Action":"None",
                      "Slot":1,
                      "PDStatus":"Operational",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"2",
                      "@Action":"None",
                      "Slot":2,
                      "PDStatus":"Operational",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"4",
                      "@Action":"None",
                      "Slot":4,
                      "PDStatus":"Operational",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"5",
                      "@Action":"None",
                      "Slot":5,
                      "PDStatus":"Operational",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    },
                    {
                      "@Number":"6",
                      "@Action":"None",
                      "Slot":6,
                      "PDStatus":"Available",
                      "Interface":"SATA",
                      "Type":"HDD",
                      "Vendor":"ATA",
                      "Product":"WDC WD5003ABYX-",
                      "Size":{
                        "@Unit":"GB",
                        "#text":465
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      }
    }
    

3 comments:

asddasasdsadsad said...

hi, thanks for this post. i am trying to delete the raid configuration. how to?
and not just one or n logical drives, i mean to clear all the configuration on all disks. do you have an idea ? thanks.

Unknown said...

Hi Masa -san,

I am truying create new RAID profile but I just got code 200 and nothing content when I get RAID profile via RESTfull API.

Please help clarify any changes in BIOS before create RAID profile.

I also sent your an email, please check and help me some comments.

Thanks
Trung

mgtechhead said...

Great blogpost - real gold - helped me alot to understand the way how to deal with json. I use Powershell - my first REST-Api Usage was writing Functions to manage Huawei Storage - check out my "blogger" mgtechhead . But as you manage here Fujistu iRMC - can you explain how to find the "network" properties they explain on page 40 - i can see WWNs on the irmc WebGui but cant find them per REST-API or CIM Client.

http://manuals.ts.fujitsu.com/file/13371/irmc-restful-spec-en.pdf

Good Bye, Folks!

As you may have heard, Fujitsu has completely discontinued Data Center Products and Solutions business in North America on April 1st, 2021. ...