【发布时间】:2019-04-18 14:52:54
【问题描述】:
我想通过 Python api 按图像创建 VM。但是,我收到错误:
"SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_InvalidValue):
Invalid value provided for 'blockDeviceTemplateGroup.globalIdentifier'.
A valid global identifier is required for a template."
我的代码如下:
import SoftLayer
from SoftLayer import VSManager
from pprint import pprint as pp
USERNAME = 'SLXXXXX'
API_KEY = 'bdf4f3124810a9e685a57xxxxxxxxxxxxxxxxxxxxxxx'
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)
mgr = SoftLayer.VSManager(client)
vsi = mgr.create_instance( hourly=True, image_id=2221859, hostname='p01', domain='esm.com', cpus=1 , memory=1, datacenter='hkg02')
print vsi
如果我使用 Python 客户端,并运行以下命令
slcli vs create --billing=hourly --image=2221859 --hostname=p01 --domain=esm.com --cpu=1 --memory=1 --datacenter=hkg02
我可以创建虚拟机。
但是通过使用python程序,我无法创建它。
图片的细节是:
:....................:......................................:
: name : value :
:....................:......................................:
: id : 2221859 :
: global_identifier : 59570b71-0a3e-4327-a89a-3dfc479ba997 :
: name : tinyproxy :
: status : Active :
: active_transaction : - :
: account : 792321 :
: visibility : Private :
: type : System :
: flex : False :
: note : None :
: created : 2019-04-18T03:04:59-05:00 :
: disk_space : 1.50G :
: datacenters : hkg02 :
:....................:......................................:
【问题讨论】:
标签: python-3.x ibm-cloud-infrastructure