Softlayer API: 无法创建图像模板。 faultCode=SoftLayer_Exception_Public, faultString=提供的块设备无效
Softlayer API: Unable to create the image template. faultCode=SoftLayer_Exception_Public, faultString=Invalid block device supplied
我正在使用下面的代码来捕获图像。
请确保不包括交换磁盘的块设备。
blockDevices = [
{
"id": 52xx5821,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
},
#{
# "id": 52yy5827,
# "complexType": "SoftLayer_Virtual_Guest_Block_Device"
#},
{
"id": 5zzz5845,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
]
try:
# Creating the transaction for the image template
response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(groupName, blockDevices, note, id=virtualGuestId)
print(response)
并且在执行代码时,出现此错误
Unable to create the image template. faultCode=SoftLayer_Exception_Public, faultString=Invalid block device supplied. Please be sure to not include the block device for a swap disk.
我通过这种方式获得了磁盘详细信息
image = client['SoftLayer_Virtual_Disk_Image'].getObject(mask=mask,id=imageId)
pp(image)
对于两个磁盘,我看到的描述是
'type': {'description': 'a disk that may be replaced on upgrade',
第三个
'type': {'description': 'a disk that is used for swap space',
我想捕获具有第一个描述的磁盘的图像。 [不是交换]。有25GB和100GB两种。
以上3个id的所有组合我都试过了。但是我总是收到这个错误。
我推荐你看这个论坛是同一个问题:
看来您得到的 ID 是错误的,根据您的问题,您使用的是 SoftLayer_Virtual_Disk_Image::getObject 方法,问题是要使用该方法,您已经需要知道 ID,并且在您的问题中不清楚您是如何获得该 ID 的。
为了获得正确的 ID,您需要使用 http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBlockDevices 方法
例如
blockDevices = 客户端['SoftLayer_Virtual_Guest'].getBlockDevices(id=virtualGuestId)
从那里你需要选择你想要的块设备,以防 属性 设备 = 1 的 blockDevice 是交换磁盘。
也可能对您有帮助:
此致
我正在使用下面的代码来捕获图像。 请确保不包括交换磁盘的块设备。
blockDevices = [
{
"id": 52xx5821,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
},
#{
# "id": 52yy5827,
# "complexType": "SoftLayer_Virtual_Guest_Block_Device"
#},
{
"id": 5zzz5845,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
]
try:
# Creating the transaction for the image template
response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(groupName, blockDevices, note, id=virtualGuestId)
print(response)
并且在执行代码时,出现此错误
Unable to create the image template. faultCode=SoftLayer_Exception_Public, faultString=Invalid block device supplied. Please be sure to not include the block device for a swap disk.
我通过这种方式获得了磁盘详细信息
image = client['SoftLayer_Virtual_Disk_Image'].getObject(mask=mask,id=imageId)
pp(image)
对于两个磁盘,我看到的描述是
'type': {'description': 'a disk that may be replaced on upgrade',
第三个
'type': {'description': 'a disk that is used for swap space',
我想捕获具有第一个描述的磁盘的图像。 [不是交换]。有25GB和100GB两种。
以上3个id的所有组合我都试过了。但是我总是收到这个错误。
我推荐你看这个论坛是同一个问题:
看来您得到的 ID 是错误的,根据您的问题,您使用的是 SoftLayer_Virtual_Disk_Image::getObject 方法,问题是要使用该方法,您已经需要知道 ID,并且在您的问题中不清楚您是如何获得该 ID 的。
为了获得正确的 ID,您需要使用 http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBlockDevices 方法
例如
blockDevices = 客户端['SoftLayer_Virtual_Guest'].getBlockDevices(id=virtualGuestId)
从那里你需要选择你想要的块设备,以防 属性 设备 = 1 的 blockDevice 是交换磁盘。
也可能对您有帮助:
此致