2016-09-16 6 views
0

現在、スナップショット領域が耐久ブロックストレージにプロビジョニングされていないかどうかを確認してから、スナップショット領域を要求します。Container_Product_Order_Network_Storage_Enterprise_Snapshotとそれに対応するサイズ範囲のpackageIdsのリストを照会するにはどうすればよいですか?

iscsi_id = helpers.resolve_id(iscsi_mgr.resolve_ids, iscsi_identifier[0],'iSCSI') 
    storage = SL.instance(sl_config).storage.getObject(mask=obj_mask, id=iscsi_id) 

    if 'snapshotCapacityGb' not in storage: 
     print "Error: there is no snapshot space allocated for Volume ID: {0}".format(iscsi_id) 
     order = { 
    "complexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise_SnapshotSpace_Upgrade", 
      "packageId": 240, 
      "prices": [{ 

       "id": 144295 
      }], 

      "volumeId": iscsi_id 
     } 

     SL.instance(sl_config).storage_order.verifyOrder(order) 

はその見返りに、私は、適切なストレージを要求するスナップショット領域「ID」のマッピングを得ることができる方法/

faultCode=SoftLayer_Exception_Public, faultString=The price for 10 GB Storage Space (#144295) is not valid for location 

取得しますか?

答えて

0

残念ながら、Control Portalは、適切な価格を得るために内部コールを行います。スナップショットスペースの価格を取得することはできません。あなたがやったことの呼び出しでの識別子を使用することができます

""" 
This script retrieves the prices that could be used to place an order for 
snapshot space 

Important manual pages: 
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItemPrices 
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getObject 
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getProperties 
http://sldn.softlayer.com/article/object-filters 

License: http://sldn.softlayer.com/article/License 
Author: SoftLayer Technologies, Inc. <[email protected]> 
""" 
import SoftLayer 

# Define your SoftLayer's username and apikey 
USERNAME = 'set me' 
API_KEY = 'set me' 

# Define the StorageId, for which you want to get the prices for snapshot space 
storageId = 1559988 

# Define packageId : 240 
packageId = 240 

# Create Client connection 
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY) 
packageService = client['SoftLayer_Product_Package'] 
storageService = client['SoftLayer_Network_Storage'] 

try: 
    # Getting provisioned IOPS from storage 
    iopsValue = storageService.getProperties(filter={"properties": {"type": {"keyname": {"operation": "PROVISIONED_IOPS"}}}}, id=storageId) 
    # Getting snapshot space 
    storageSize = storageService.getObject(mask="mask[serviceResource[networkDevice[datacenter]]]", id=storageId) 

    # Getting IOPS e.g: 0.25, 2, 4 
    x = int(iopsValue[0]['value'])/int(storageSize['capacityGb']) 
    if(x == 0.25): 
     x = 100 
    elif(x == 2): 
     x = 200 
    elif(x == 4): 
     x = 300 

    # Define an object filter to get prices 
    objectFilter = {"itemPrices": {"categories": {"categoryCode": {"operation": "storage_snapshot_space"}}, 
            "locationGroupId": {"operation": "is null"}, 
            "item": {"capacity": {"operation": "<=" + str(storageSize['capacityGb'])}}, 
            "capacityRestrictionMaximum": {"operation": x}, 
            "capacityRestrictionMaximum": {"operation": x}, 
            }} 
    # Getting prices 
    prices = packageService.getItemPrices(filter=objectFilter, id=packageId) 
    for price in prices: 
     print("Price: %s Capacity: %s" % (price['id'], price['item']['capacity'])) 
except SoftLayer.SoftLayerAPIError as e: 
    print("Unable to get the prices. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString)) 

:あなたはControl Portalのようなスナップショットスペースの識別子(ID)を得ることができます

は、次のスクリプトを使用して、ありません。

"のcomplexType":

"のcomplexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise_SnapshotSpace"

の代わりを


は、念のために、あなたが使用する必要があります "SoftLayer_Container_Product_Ordストレージがまだスナップショットを持たない場合は、er_Network_Storage_Enterprise_SnapshotSpace_Upgrade "

です。 私はそれが助けて、何か疑念やコメントを知らせたいと思う。

関連する問題