小编典典

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

python

即使现在,我们也可以使用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.

阅读 169

收藏
2021-01-20

共1个答案

小编典典

“软件包759进行了一些更改,因为它需要volumeSize属性来设置所需的存储空间,请注意此volumeSize属性必须在产品的容量范围内才能正常工作(例如:1
– 12000范围itemPrice 194733“
Storage_Space”),并且数据类型容器也必须为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
}
2021-01-20