-1

I need details of Authorized host(Virtual Machine) like username, password, hostIQN and Storage target Address through REST API.

From Stack Overflow, I got the API by which I can get the mentioned details,

"https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage/[storage_id]/getObject?objectMask=mask[id,username,allowedVirtualGuests[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedHardware[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedIpAddresses[ipAddress,allowedHost[name,credential[username,password]]]]

Method: GET"

Now, as you you know under a particular storage we can authorized more than one virtual machine, so from the above api I am getting response of several vm if several VM are authorized under a storage.

How will I find out the details of one particular VM from the response, do I have to pass some extra parameter with the api?

halfer
  • 19,824
  • 17
  • 99
  • 186
Dave
  • 1
  • 5

1 Answers1

0

It's possible to get that information using Object Filters, you can try the following request:

https://[username]:[aoiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage/[storageId]/getAllowedVirtualGuests?objectFilter={"allowedVirtualGuests":{"id":{"operation": "9222721"}}}&objectMask=mask[fullyQualifiedDomainName,allowedHost[name,credential[username,password], assignedVolumes[id, username]]]

Method: Get

Replace: [username], [apiKey], [storageId] and 9222721 (The VM's identifier) with your own information.


Just in case, it's not possible to apply filter over fullyQualifiedDomainName, but it's possible to use the hostname, so, in case that you want to get information through this property, try this:

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage/[storageId]/getAllowedVirtualGuests?objectFilter={"allowedVirtualGuests":{"hostname":{"operation": "testhost"}}}&objectMask=mask[fullyQualifiedDomainName,allowedHost[name,credential[username,password], assignedVolumes[id, username]]]

Method: Get

Replace: [username], [apiKey], [storageId] and testhost (The VM's hostname) with your own information.


If you want to get this information for baremetal servers, you need to use the following method:

References: