1

How to create, attach/detach, delete volume to bare metal server?

I am trying with this api.

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/allowAccessFromHostList
Payload ={
  "parameters": [
    [
      {
        "id": 1234567,
        "objectType": "SoftLayer_Virtual_Guest"
      }
    ]
  ]
}

Where: 1234567 is the Virtual Server Instance

Kindly help me with this.

1 Answers1

1

I do not get what is your question :S, the method that you are using is the correct and the payload as well is the correct, however the last time I checked the method it returns empty result, but the server are added successfully (that issue was already reported).

The contol portal uses these methods to attach the servers:

http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHardwareList http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromVirtualGuestList

you need to pick the more suitable for you. e.g. if you need to add virtual guest you need to use the allowAccessFromVirtualGuestList method.

the use is very simple here an example using REST:

POST https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/allowAccessFromVirtualGuestList

Payload
{
    "parameters": [
        [{
            "id": 123456
        }, {
            "id": 78910
        }]
    ]
}

Note: replace the IDs in the payload with the IDs of your Virtual Guests

To remove the server you can use these methods:

http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/removeAccessFromHardwareList http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/removeAccessFromVirtualGuestList

The use is similar:

POST https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/removeAccessFromVirtualGuestList

    Payload
    {
        "parameters": [
            [{
                "id": 123456
            }, {
                "id": 78910
            }]
        ]
    }

    Note: replace the IDs in the payload with the IDs of your Virtual Guests

You just need keep in mind that you only can add Virtual Guests and Servers which are in the same datacenter as the Network storage and also there is a limit of virtual guests/servers you can add, I recomend you to check if you can add a particular virtual guest/server to the storage volume using the control portal in case you get any error using the API.

Just in case to allow bare metal servers using the allowAccessFromHostList method you need to use this Request:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/allowAccessFromHostList
Payload ={
  "parameters": [
    [
      {
        "id": 1234567,
        "objectType": "SoftLayer_Hardware_Server"
      }
    ]
  ]
}

Note: In case you get error try changing the "objectType": "SoftLayer_Hardware_Server" by "objectType": "SoftLayer_Hardware"

Regards