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
470 views
in Technique[技术] by (71.8m points)

asp.net web api - API for Performance and Endurance storage(Block storage)

We are a part of DST India team and currently we are working for an offering for our client where we are trying to integrate performance and endurance storage features (of SoftLayer) in ICO using REST API provided by SoftLayer. I have gone through SoftLayer documentation but I'm not able to find the same.

So, Could you kindly provide us following information?

  1. please provide API for creating endurance storage (along with the parameters required)
  2. please provide API for creating performance storage (along with the parameters required)
  3. please provide API for attaching endurance storage (along with the parameters required)
  4. please provide API for attaching performance storage (along with the parameters required)
See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

To order Endurance, execute:

Configuration:

Package to use = 240
Storage Type: Endurance
Location: Dal06
Storage Package: 0.25 IOPS/GB
Storage Size: 20GB
Snapshot Space Size: 0GB
OS Type: Linux

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

Method: POST

Json Payload:

{
  "parameters": [
    {
      "location": 154820,  //Dallas 06
      "packageId": 240,
      "osFormatType": {
        "id": 12,
        "keyName": "LINUX"
      },
      "complexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
      "prices": [
        {
          "id": 45058   # Endurance Storage
        },
        {
          "id": 45098   # Block Storage
        },
        {
          "id": 45068   # 0.25 IOPS per GB
        },
        {
          "id": 45118   # 20 GB Storage Space
        },
        {
          "id": 46120   # 5 GB Storage Space - Snapshot
        }
      ],
      "quantity": 1
    }
  ]
}

Notes:

  • change from "verifyOrder" method to "placeOrder" once that your configuration is ready
  • Remove the comments set in the prices ids to get a valid Json (e.g. remove --> # Endurance Storage)

How to get the valid item prices to order Endurance/Performance Storage?

Execute the following according to package to use:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/[package_id]/getItemPrices?objectMask=mask[id,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]

Method: GET

Where:
 A price id with a locationGroupId = null is considered "A standard price" and the API will internally switch the prices for the customer. But we recommend to execute first the verifyOrder in order to see if the wanted order is ok (the fee can vary).

To Order Performance Storage:

Configuration:

Package to use: 222
Storage Type: Performance
Location: Dallas 06
Storage Size: 20GB – 100 to 1000 IOPS
Specify IOPS: 100
Select OS Type: Linux

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

Method: POST

Json Payload:

{
  "parameters": [
    {
      "packageId": 222,
      "location": 154820,
      "osFormatType": {
        "id": 12,
        "keyName": "LINUX"
      },
      "complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi",
      "prices": [
        {
          "id": 40672   # Block Storage (Performance)
        },
        {
          "id": 40682   # 20 GB Storage Space
        },
        {
          "id": 40792   # 100 IOPS
        }
      ],
      "quantity": 1
    }
  ]
}

To authorize/allow hosts, please execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[Storage_id]/allowAccessFromHostList

Method: POST

{
  "parameters": [
    [
      {
        "id": 13548553,
        "objectType": "SoftLayer_Virtual_Guest"
      }
    ]
  ]
}

The Above request is used to authorize “Endurance” and “Performance” If you want to authorize “Virtual Guest”,“IpAddress” or “Hardware”, valid values for “objectType” are:

“SoftLayer_Virtual_Guest “,”SoftLayer_Network_Subnet_IpAddress”, ”SoftLayer_Hardware” respectively.

Reference:

http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/allowAccessFromHostList

The “network storage” and VSI/Bar Metal/Subnet must to be located in the same location/datacenter. These requests help us to get available hosts can be authorized to an specific “network storage” as we can see in the Portal:

To get valid available subnets with associated IP addresses, execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/ getAllowableSubnets?objectMask=mask[id,networkIdentifier,cidr,subnetType,ipAddresses[id,ipAddress]]

Method: GET

To get valid available virtual guests, please execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage_Iscsi/[storage_id]/getAllowableVirtualGuests?objectMask=mask[id,fullyQualifiedDomainName] 

Method: GET

Available Bar metal:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Network_Storage/[storage_id]/getAllowableHardware
Method: GET

Update 1:

Additionally, to get network Storage list, please see: SoftLayer_Account::getNetworkStorage

This is an example, where the result displays properties like: “location” and “network storage type” using object Masks.

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[storageType, billingItem[description,location[id,longName]]]

Method: GET

Using filters:

Filtering by network Storage Type: “Endurance Storage” or “Block Storage (Performance)”

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[id,username,nasType,storageType, billingItem[description,location[id,longName]]]&objectFilter={"networkStorage":{"nasType":{"operation":"ISCSI"},"billingItem":{"description":{"operation":"Endurance Storage"}}}}
Method: GET

Other link may help you:

API for Listing All Performance Storages for a user


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

...