HPE OneView
1752672 Members
6202 Online
108789 Solutions
New Discussion

Re: REST change boot order

 
bsadigh
New Member

REST change boot order

Hello,

I'm having a really hard time to change to boot order on servers managed by one view, from the REST API.

I have done it with ilo rest api before, with ease, but i'm not having any luck with one view.

Moreover, i can't get any example in the docs or from my research.

Did anyone managed to do it ? 

Thanks in advance.

3 REPLIES 3
ChrisLynch
HPE Pro

Re: REST change boot order

Boot order management is performed in the Server Profile.  Have you not looked at PUT /rest/server-profiles/{id} ?  Here is an example of a Server Profile with the Boot Order configured:

{
        "uri": "/rest/server-profiles/{id}",
        "type": "ServerProfileV5",
        "name": "Profile101",
        "serverHardwareUri": "/rest/server-hardware/{id}",
        "affinity": "Bay",
        "hideUnusedFlexNics":true,
        "connections": [],
        "bootMode": {
            "manageMode": true,
            "mode": "BIOS"
         },
        "boot": {
            "manageBoot": true,
            "order": ["PXE",
            "HardDisk",
            "CD",
            "Floppy",
            "USB"]
        },
        "bios": {
            "manageBios": false
        },
        "localStorage": {
            "controllers": [{
                "slotNumber": "0",
                "managed": true,
                "mode": "RAID",
                "initialize": false,
                "importConfiguration": false,
                "logicalDrives": [
                  {
                    "driveName": "Operating System",
                    "raidLevel": "RAID0",
                    "bootable": true,
                    "driveTechnology": null,
                    "numPhysicalDrives": "1"
                  },
                  {
                    "driveName": "Recovery Volume",
                    "raidLevel": "RAID1",
                    "bootable": false,
                    "driveTechnology": "SasHdd",
                    "numPhysicalDrives": "2"
                }]
            }]
        },        
        "firmware": {
            "manageFirmware": true,
            "firmwareBaselineUri": "/rest/firmware-drivers/{fwBaselineId}",
            "forceInstallFirmware": false
        }
    

I am an HPE employee

Accept or Kudo

Quma
New Member

Re: REST change boot order

I can give you some general guidance on how you can approach this task.

Authentication: First, ensure you have proper authentication to access the OneView REST API. You will need a valid session token or API key to authenticate your requests.

API Documentation: Review the official HPE OneView REST API documentation. This documentation should contain the necessary endpoints and methods to manipulate server configurations, including the boot order.

Identify Server: Make sure you correctly identify the server you want to change the boot order for. You will need to know the server's URI or unique identifier.

Boot Order: Look for specific endpoints related to the server's boot order. The documentation should have details about the available properties and values to set the desired boot order.

HTTP Requests: Use the appropriate HTTP methods (usually POST or PUT) to modify the server configuration. For example, you might need to make a PUT request to set the new boot order for the server.

Request Headers: Set the necessary headers, such as "Content-Type" to specify the data format (usually JSON), and "Auth" to include your authentication token/API key.

Request Body: Provide the required data in the request body, such as the new boot order sequence.

Error Handling: Handle the responses appropriately. Check the status code and response body for any error messages or indications of success.

As an additional tip, consider using tools like Postman or cURL to test your API requests interactively before integrating them into your code. They can be helpful in understanding the responses and debugging any issues.

bradawk1
Trusted Contributor

Re: REST change boot order

As Chris mentioned, this is something that is best controlled by a server profile, or if you have a group of like servers, set it in a server profile template.  It is extremely useful in maintaining uniformity across a group of servers.  If you have to make a single change and don't want to use OneView, ilorest, hponcfg (maybe - not sure if it can?), or iLO Redfish API are your best tools.  With Redfish, you can use your OneView REST credentials to get iLO login credentials.