0

I would like to get the portable disk size per each of my vms.

  1. Get ID of VMs by requesting curl --user ":" -sk https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualDiskImages

  2. Get List of VMs by requesting with Key=ID curl --user ":" -sk https://api.softlayer.com/rest/v3//SoftLayer_Virtual_Guest/Key

  3. No method to get PortableStorageVolumes with key=VM's ID

There is only method to get PortableStorageVolumes under 'SoftLayer_Account' so that i cannot get volume size per vm id.

halfer
  • 19,824
  • 17
  • 99
  • 186
Daul
  • 11
  • 1

1 Answers1

0

Unfortunately, there is not method in SoftLayer_VIrtual_Guest service which can help to retrieve portable storage volumes information.

As workaround, It's possible to get this information through SoftLayer_Account::getPortableStorageVolumes but we need to use an Object Filter, below a request which can help to retrieve Portable Storage for a specific Virtual Guest:

curl -k "https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPortableStorageVolumes?objectFilter={"portableStorageVolumes":{"blockDevices":{"guest":{"id":{"operation":123123123}}}}}"

Replace: $user, $apiKey and 123123123(VSI id) with your own information

If you have a problem with encoding, try this:

curl -k "https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Account/getPortableStorageVolumes?objectFilter=%7B%22portableStorageVolumes%22%3A%7B%22blockDevices%22%3A%7B%22guest%22%3A%7B%22id%22%3A%7B%22operation%22%3A123123123%7D%7D%7D%7D%7D"

Replace: $user, $apiKey and 123123123(VirtualGuest's id)

  • Thanks for your reply. But i do not understand well how to use objectFilter and what i should specify there. it seems to be using DB table relationship, could you please explain me this part? objectFilter={"portableStorageVolumes":{"blockDevices":{"guest":{"id":{"operation":123123123}}}}}" – Daul Jul 07 '17 at 00:22
  • Review this forum please: [How to use object filter with softlayer rest api?](https://stackoverflow.com/questions/41186972/how-to-use-object-filter-with-softlayer-rest-api) it provides information about them, let me know any doubt or comment – Ruber Cuellar Valenzuela Jul 07 '17 at 13:42