我们如何订购"存储即服务(StaaS)"?

时间:2017-06-14 01:53:59

标签: python ibm-cloud-infrastructure

我们甚至可以使用packageId 240订购Endurance Storage。 但是最近有针对Endurance Storage的更新,它可以在静态时加密,并在更细粒度的水平上选择,例如,1,2,3 ...... TB而不是1,2,4 ...... TB。

然后我们似乎必须使用名为"存储即服务(StaaS)"

的另一个包759

这是我们的尝试。 你能澄清一下错误吗?

我们的目标是使用新的Endurance菜单一次订购6TB LUN卷。

#import package
import SoftLayer
import json

# account info
client = SoftLayer.create_client_from_env()

order = {
"orderContainers": [
{
            "complexType":"SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
            "osFormatType":{  
            "id":12,
            "keyName":"LINUX"
            },
            'location': 449604, # Tokyo
            'packageId': 759,  # Storage As A Service (StaaS)
            'prices': [
                    {'id':189433},  # Storage As A Service
                    {'id':189453},  # File storage 
                    {'id':194703},  #  4 IOPS per GB 
                    {'id': 194733}  # Storage space for 4 IOPS per GB 
                    #{'id': 190443}  # 4000 - 7999 GBs
            ],      
    }
],
    'quoteName': "Endurance_Storage",
    'sendQuoteEmailFlag': False
}   

# placeQuote
placeQuote = client['Product_Order'].placeQuote(order)
#placeQuote = client['Product_Order'].verifyOrder(order)

#jsonstring = json.dumps(placeQuote,indent=4)
#print(jsonstring) 

```

这是错误。

$ python placeQuoteSTaaSTemplate.py 
Traceback (most recent call last):
  File "placeQuoteSTaaSTemplate.py", line 32, in <module>
placeQuote = client['Product_Order'].placeQuote(order)
  File "/Library/Python/2.7/site-packages/SoftLayer/API.py", line 392, in call_handler
return self(name, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/SoftLayer/API.py", line 360, in call
return self.client.call(self.name, name, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/SoftLayer/API.py", line 263, in call
return self.transport(request)
  File "/Library/Python/2.7/site-packages/SoftLayer/transports.py", line 195, in __call__
raise _ex(ex.faultCode, ex.faultString)
SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_Order_Item_Invalid): Invalid price Storage as a Service (189433) provided on the order container.

1 个答案:

答案 0 :(得分:0)

“759包有一些变化,因为它需要volumeSize属性来设置你需要的存储空间,请记住这个volumeSize属性必须在产品的容量范围内才能正常工作(例如:1 - itemPrice 194733“Storage_Space”上的12000范围,以及数据类型容器必须是SoftLayer_Container_Product_Order_Network_Storage_AsAService。

请在代码中使用以下订单模板:

order = {
    "complexType": "SoftLayer_Container_Product_Order_Network_Storage_AsAService",
    "volumeSize": 6000,

    "osFormatType":{
            "id":12,
            "keyName":"LINUX"
            },
    "location": 449604,
    "quantity": 1,
    "packageId": 759,
    "prices": [
{'id': 189433},  # Storage As A Service
                {'id': 189453},  # File storage 
{'id': 194703},  # 4 IOPS per GB 
{'id': 194733}  # Storage space for 4 IOPS per GB    
],
    'quoteName': "Endurance_Storage",
    'sendQuoteEmailFlag': False
}