Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
963 views
in Technique[技术] by (71.8m points)

python - How can we order "Storage As A Service (StaaS)"?

We are able to order Endurance Storage using packageId 240 even now. However there are recent updates for Endurance Storage, it can be encrypted at rest and selected at more granular level, for example, 1, 2, 3... TB rather than 1, 2, 4... TB.

Then we seem to have to use another package 759 named "Storage As A Service (StaaS)"

Here is our attempt. Could you clarify what's wrong?

Our goal is to order 6TB LUN volume at once with new Endurance menu.

#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) 

```

This is the error.

$ 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.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

“There has been a few changes for the package 759 as it requires volumeSize property to set the storage space as you require, please take in count this volumeSize property must be within the product's capacity range to work properly (e.g.: 1 – 12000 range on itemPrice 194733 “Storage_Space”), and also the datatype container has to be SoftLayer_Container_Product_Order_Network_Storage_AsAService.

Please use the following order template in your code:

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
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...