November 23, 2017
Get unattached portal storages.

The script gets all the unattached portal storages in the account.

Important manual pages:
import SoftLayer

# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'

client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
accountService = client['SoftLayer_Account']

# Declaring a object mask to get information about the guest
# of the portal storage.
objeckMask = "mask[storageRepository[guests]]"

unattachedPortalStorages = []

# Looking for the portal storages which do not have any guest.
    portableStorages = accountService.getPortableStorageVolumes(mask=objeckMask)
    for storage in portableStorages:
        if 'storageRepository' in storage:
            if len(storage['storageRepository']['guests']) == 0:
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to retrieve the portable storage list. "
          % (e.faultCode, e.faultString))


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue