SoftLayer API: 如何从图像模板中获取 blockDevice 信息?

SoftLayer API: How to get the blockDevice information from a image template?

我有一个图像模板,如图所示。我想获取图中标记的磁盘 space 和虚拟磁盘列表。我用过:

http://sldn.softlayer.com/zh/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/getObject to get the image template with mask as ('mask[id,accountId,name,globalIdentifier,blockDevices[device,diskImageId,diskSpace,groupId,id,units],parentId,createDate,datacenter,imageType,storageRepository,datacenters]')

掩码 blockDevices 已设置。但是结果是这样的:

{'accountId': xxxxxxx,
 'blockDevices': [],
 'createDate': '2016-09-18T07:16:57-05:00',
 'datacenters': [{'id': xx4092,
                  'longName': 'Singapore 1',
                  'name': 'sng01',
                  'statusId': 2}],
 'globalIdentifier': 'xxxxxxxx-b068-40b1-8377-9ab66df80131',
 'id': 1331697,
 'imageType': {'description': 'a disk that may be replaced on upgrade',
               'keyName': 'SYSTEM',
               'name': 'System'},
 'name': 'xxx-test-all-disk',
 'parentId': ''}

blockDevices项为空数组。为什么?

任何 api 可以帮助我获取图像磁盘 space 和虚拟磁盘信息?

请尝试以下 mask(这是一个 Rest 示例):

 https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest_Block_Device_Template_Group/[imageId]/getObject?objectMask=mask[id,name,children[id,name,blockDevices[diskSpace,units,diskImage[localDiskFlag]]]]

Method:GET 

children 项包含您需要的信息。目前,您正在尝试获取 parentitem。

希望对你有所帮助