April 28, 2016

Get storage credentials for Block Storage

Retrieving the username and password for Performance/Endurance Block storage

The following script allows you retrieve the username and password for Performance/Endurance Block storage if you have authorized hosts against the storage.

Get credentials for a authorized hosts of a SoftLayer_Network_Storage_Iscsi 

Important manual pages

import SoftLayer
import json

iscsiStorageId = 1234567

client = SoftLayer.create_client_from_env()
networkStorageIscsiService = client['SoftLayer_Network_Storage_Iscsi']

objectMask = 'mask[allowedHardware[allowedHost[credential]],allowedVirtualGuests[allowedHost[credential]]]'

    iscsiStorage = networkStorageIscsiService.getObject(mask=objectMask, id=iscsiStorageId)
    print(json.dumps(iscsiStorage, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to retrieve the Network Storage Iscsi. faultCode=%s, faultString=%s"
        % (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