How to proceed to attach and detach a storage block endurance to a Virtuel Machine from the API.
2 Answers
To authorize/allow hosts to a Network Storage (i.e. Endurance), please execute:
URL:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/allowAccessFromHostList
Method: POST
Json Payload:
{
"parameters": [
[
{
"id": 1234567,
"objectType": "SoftLayer_Virtual_Guest"
}
]
]
}
Where: 1234567 is the Virtual Server Instance
The Above request is used to authorize “Endurance” and “Performance”.
If you want to authorize “Virtual Guest”,“IpAddress” or “Hardware”, valid values for “objectType” are:
“SoftLayer_Virtual_Guest “,”SoftLayer_Network_Subnet_IpAddress”, ”SoftLayer_Hardware” respectively.
Reference: SoftLayer_Network_Storage::allowAccessFromHostList
Note: The “network storage” and VSI/Bar Metal/Subnet must to be located in the same location/datacenter.
These requests help us to get available hosts can be authorized to a specific “network storage” as we can see in the Portal:
To get valid available virtual guests, please execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName]
Method: GET
Reference: SoftLayer_Network_Storage::getAllowableVirtualGuests
Available Bar metal:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableHardware
Method: GET
Reference: SoftLayer_Network_Storage::getAllowableHardware
To get valid available subnets with associated IP addresses, execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/ getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]
Method: GET
Once you ordered the storage you have to follow these steps:
Authorize the host you want to access to the storage
Mount the storage to your host
Via API you only can authorize a host from a VSI or bare metal server in order this server has the permission to mount the endurance block storage, but the mount proccess must be manually.
To authorize the block storages via API you use these methods: http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHostList http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/allowAccessToNetworkStorage http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/allowAccessToNetworkStorage
To mount the storage see these documentation: https://knowledgelayer.softlayer.com/procedure/accessing-block-storage-linux https://knowledgelayer.softlayer.com/procedure/accessing-block-storage-microsoft-windows https://knowledgelayer.softlayer.com/procedure/accessing-file-storage-linux https://knowledgelayer.softlayer.com/content/ordering-and-configuring-endurance-and-performance-block-storage-vmwaresoftlayer https://knowledgelayer.softlayer.com/procedure/endurance-provisioning
Regards