2016-08-20 2 views
0

저는 파이썬 소프트 레이어를 사용하여 가상 서버의 인스턴스를 만듭니다. 디스크 크기를 2 개 지정하면 요청을 확인할 수 있습니다. 디스크 크기를 1 개만 요청하면 호출이 실패합니다. 기본 크기를 사용하고 싶지 않습니다. 100GB 드라이브를 어떻게 지정합니까?파이썬을 통해 Softlayer 가상 서버에 단일 디스크 크기를 지정하는 방법

샘플 요청 : 나는 다양한 입력을 시도했습니다

vsi_request= { 
    'cpus': 2, 
    'memory': 6144, 
    'hourly': True, 
    'hostname': 'test', 
    'domain': u'sample.domain.com', 
    'local_disk': False, 
    'datacenter': datacenter_code, 
    'os_code' : u'UBUNTU_14_64', 
    'dedicated': False, 
    'private_vlan': 1234, 
    'post_uri': 'https://bla', 
    'private': True, 
    'ssh_keys': [2345], 
    'nic_speed': 1000, 
    'tags': 'test, pleaseCancel', 
    'disks': ('100') <---- This makes it fail 
} 
vsi = vsmgr.verify_create_instance(**vsi_request) 

:

# <no disks specification> success, default to 25 GB 
#('100', '10') success 
#('100') Unable to find prices for block device 0 with capacity of 1. 
#('25') Unable to find prices for block device 0 with capacity of 2. 
## Some invalid values just to see the error message 
#('500') Unable to find prices for block device 0 with capacity of 5. 
#('100', '4') Unable to find prices for block device 2 with capacity of 4. 
#('100', '0') Unable to find prices for block device 2 with capacity of 0. 

관련 스택 추적 :

Traceback (most recent call last): 
vsi = vsmgr.verify_create_instance(**vsi_request) 
File "C:\Python27\lib\site-packages\SoftLayer\managers\vs.py", line 475, in verify_create_instance 
return self.guest.generateOrderTemplate(create_options) 
File "C:\Python27\lib\site-packages\SoftLayer\API.py", line 373, in call_handler 
return self(name, *args, **kwargs) 
File "C:\Python27\lib\site-packages\SoftLayer\API.py", line 341, in call 
return self.client.call(self.name, name, *args, **kwargs) 
File "C:\Python27\lib\site-packages\SoftLayer\API.py", line 237, in call 
return self.transport(request) 
File "C:\Python27\lib\site-packages\SoftLayer\transports.py", line 187, in __call__ 
raise _ex(ex.faultCode, ex.faultString) 
SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_NotFound): Unable to find prices for block device 0 with capacity of 1. 

답변

1

, 이것을 시도하십시오 :

'disks': ['100'] 
,

또는

'disks': ('100',) 

는 예컨대 : 또한

vsi_request= { 
    'cpus': 2, 
    'memory': 6144, 
    'hourly': True, 
    'hostname': 'test', 
    'domain': u'sample.domain.com', 
    'local_disk': False, 
    'datacenter': datacenter_code, 
    'os_code' : u'UBUNTU_14_64', 
    'dedicated': False, 
    'private_vlan': 1234, 
    'post_uri': 'https://bla', 
    'private': True, 
    'ssh_keys': [2345], 
    'nic_speed': 1000, 
    'tags': 'test, pleaseCancel', 
    'disks': ['100'] 
} 

, 나는 VSI를 주문 가능한 옵션을 얻을 수을 get_create_options를 사용하는 것이 좋습니다 :

mgr.get_create_options() 
관련 문제