-->

SoftLayer Object Storage API: Creation of 250GB/50

2019-09-15 11:23发布

问题:

I am deploying CloudFoundry and internally calling SoftLayer API to create 250GB iSCSI disk but causes error as below.
In similar method, 500GB disk creation caused error, but 20GB or 1000GB creation were success.

Is it SoftLayer API issue or my environment changed some price list?

{"method":"create_disk","arguments":[250000,{},"29211213"],"context":{"director_uuid":"c789ac25-4e92-419c-4b9e-a95d0927a8ec"}}
********************
[json] 2017/03/08 22:36:43 DEBUG - Deserialized request
********************
{create_disk [250000 map[] 29211213]}
********************

---
[softlayer-go] Request:
GET /rest/v3/SoftLayer_Virtual_Guest/29211213/getObject.json?objectMask=accountId;createDate;dedicatedAccountHostOnlyFlag;domain;fullyQualifiedDomainName;hostname;hourlyBillingFlag;id;lastPowerStateId;lastVerifiedDate;maxCpu;maxCpuUnits;maxMemory;metricPollDate;modifyDate;notes;postInstallScriptUri;privateNetworkOnlyFlag;startCpus;statusId;uuid;userData.value;localDiskFlag;globalIdentifier;managedResourceFlag;primaryBackendIpAddress;primaryIpAddress;location.name;location.longName;location.id;datacenter.name;datacenter.longName;datacenter.id;networkComponents.maxSpeed;operatingSystem.passwords.password;operatingSystem.passwords.username;blockDeviceTemplateGroup.globalIdentifier;primaryNetworkComponent.networkVlan.id;primaryBackendNetworkComponent.networkVlan.id HTTP/1.1
Host: api.softlayer.com


[softlayer-go] Response:
HTTP/1.1 200 OK
Connection: close
Content-Length: 1680
Content-Type: application/json
Date: Thu, 09 Mar 2017 04:36:44 GMT
Server: Apache
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN

{"accountId":604909,"createDate":"2017-03-08T22:31:35-06:00","dedicatedAccountHostOnlyFlag":false,"domain":"softlayer.com","fullyQualifiedDomainName":"director-dysa-ca-east.softlayer.com","hostname":"director-dysa-ca-east","id":29211213,"lastPowerStateId":null,"lastVerifiedDate":null,"maxCpu":4,"maxCpuUnits":"CORE","maxMemory":8192,"metricPollDate":null,"modifyDate":"2017-03-08T22:35:18-06:00","startCpus":4,"statusId":1001,"uuid":"5373b553-16a9-9834-9433-538e4f99bc5d","blockDeviceTemplateGroup":{"globalIdentifier":"99120edd-f394-438a-bb8f-f0b777967edd"},"datacenter":{"id":448994,"longName":"Toronto 1","name":"tor01"},"globalIdentifier":"8ec68b88-8593-4c14-a031-52b2f308076c","hourlyBillingFlag":true,"localDiskFlag":true,"location":{"id":1209443,"name":"04"},"managedResourceFlag":false,"networkComponents":[{"maxSpeed":1000},{"maxSpeed":1000}],"operatingSystem":{"hardwareId":null,"id":14845517,"manufacturerLicenseInstance":"","passwords":[{"password":"******","username":"root"}],"softwareLicense":{"id":1932,"softwareDescriptionId":1342,"softwareDescription":{"controlPanel":0,"id":1342,"licenseTermValue":null,"longDescription":"Ubuntu 14.04-64 Minimal for VSI","manufacturer":"Ubuntu","name":"Ubuntu","operatingSystem":1,"referenceCode":"UBUNTU_14_64","upgradeSoftwareDescriptionId":null,"upgradeSwDescId":null,"version":"14.04-64 Minimal for VSI","virtualLicense":0,"virtualizationPlatform":0,"requiredUser":"root"}}},"primaryBackendIpAddress":"10.166.221.170","primaryBackendNetworkComponent":{"networkVlan":{"id":1466879}},"primaryIpAddress":"169.55.185.149","primaryNetworkComponent":{"networkVlan":{"id":1466873}},"privateNetworkOnlyFlag":false,"userData":[]}
[SoftLayerDiskCreator] 2017/03/08 22:36:44 DEBUG - Creating disk of size '250000'

---
[softlayer-go] Request:
GET /rest/v3/SoftLayer_Product_Package/222/getItemPrices.json?objectFilter={"itemPrices":{"item":{"keyName":{"operation":"250_GB_PERFORMANCE_STORAGE_SPACE"}}}}&objectMask=filteredMask[id;locationGroupId;item.id;item.keyName;item.units;item.description;item.capacity] HTTP/1.1
Host: api.softlayer.com


[softlayer-go] Response:
HTTP/1.1 200 OK
Connection: close
Content-Length: 1165
Content-Type: application/json
Date: Thu, 09 Mar 2017 04:36:44 GMT
Server: Apache
Softlayer-Total-Items: 7
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN

[{"id":82419,"locationGroupId":509,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":82413,"locationGroupId":503,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":82415,"locationGroupId":505,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":154295,"locationGroupId":583,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":40728,"locationGroupId":null,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":82417,"locationGroupId":507,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}},{"id":82421,"locationGroupId":545,"item":{"capacity":"250","description":"250 GB Storage Space","id":5138,"keyName":"250_GB_PERFORMANCE_STORAGE_SPACE","units":"GB"}}]

---
[softlayer-go] Request:
GET /rest/v3/SoftLayer_Product_Package/222/getItemPrices.json?objectFilter={"itemPrices":{"attributes":{"value":{"operation":250}},"categories":{"categoryCode":{"operation":"performance_storage_iops"}}}}&objectMask=filteredMask[id;locationGroupId;item.id;item.keyName;item.units;item.description;item.capacity] HTTP/1.1
Host: api.softlayer.com


[softlayer-go] Response:
HTTP/1.1 200 OK
Connection: close
Content-Length: 2
Content-Type: application/json
Date: Thu, 09 Mar 2017 04:36:44 GMT
Server: Apache
Softlayer-Total-Items: 0
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN

[]
[json] 2017/03/08 22:36:46 DEBUG - CloudError response bytes
********************
{"result":null,"error":{"type":"Bosh::Clouds::CloudError","message":"Creating disk of size '250000': Create SoftLayer iSCSI disk error.: No proper performance storage (iSCSI volume)for size 250","ok_to_retry":false},"log":""}
********************

回答1:

The short answer is that you need to use 1000 instead 250 or 500 in this request if you wanna keep using the same filters:

Request:
GET /rest/v3/SoftLayer_Product_Package/222/getItemPrices.json?objectFilter={"itemPrices":{"attributes":{"value":{"operation":250}},"categories":{"categoryCode":{"operation":"performance_storage_iops"}}}}&objectMask=filteredMask[id;locationGroupId;item.id;item.keyName;item.units;item.description;item.capacity] HTTP/1.1
Host: api.softlayer.com

The long answer is that you will not able to get those values using softlayer´s filters and you will need to use your own code to filter those values, that is because the IOPS prices have a retriction of Storage CApacity e.g.

rest/v3/SoftLayer_Product_Package/222/getItemPrices.json?objectMask=filteredMask[attributes,capacityRestrictionMaximum,capacityRestrictionMinimum,id,locationGroupId,item[id,keyName,units,description,capacity]]
{
        "id": 41522,
        "locationGroupId": null,
        "attributes": [
            {
                "id": 11860,
                "itemPriceAttributeTypeId": 21,
                "itemPriceId": 41522,
                "value": "100",
                "itemPriceAttributeType": {
                    "id": 21,
                    "keyname": "CAPACITY_RESTRICTION_MIN"
                }
            },
            {
                "id": 11862,
                "itemPriceAttributeTypeId": 22,
                "itemPriceId": 41522,
                "value": "1000",
                "itemPriceAttributeType": {
                    "id": 22,
                    "keyname": "CAPACITY_RESTRICTION_MAX"
                }
            },
            {
                "id": 11864,
                "itemPriceAttributeTypeId": 24,
                "itemPriceId": 41522,
                "value": "STORAGE_SPACE"
            }
        ],

In the result above you can see the vales CAPACITY_RESTRICTION_MAX and

CAPACITY_RESTRICTION_MIN those values mean that the price is valid for storage from 100 GBs to 1000 GBs, so this price is good for storages of 250 GBs and 500GBs. The filter that you are using is filtering those values in this case you would have to change the filter to verify if your storage (in this case 250GBs) is between this range of values, but it cannot be done using Softlayer´s filters because the value to filter is string and not a single integer e.g.:

 "value": "100"

So you need to parse that value to integer and then verify if it is into the range (which is not possible using Softlayer´s filters).

The reason why your current filter is working for other values is because the CAPACITY_RESTRICTION_MAX and CAPACITY_RESTRICTION_MIN have the same value e.g.

"id": 40792,
        "locationGroupId": null,
        "attributes": [
            {
                "id": 9670,
                "itemPriceAttributeTypeId": 21,
                "itemPriceId": 40792,
                "value": "20",
                "itemPriceAttributeType": {
                    "id": 21,
                    "keyname": "CAPACITY_RESTRICTION_MIN"
                }
            },
            {
                "id": 9672,
                "itemPriceAttributeTypeId": 22,
                "itemPriceId": 40792,
                "value": "20",
                "itemPriceAttributeType": {
                    "id": 22,
                    "keyname": "CAPACITY_RESTRICTION_MAX"
                }
            },
            {
                "id": 9674,
                "itemPriceAttributeTypeId": 24,
                "itemPriceId": 40792,
                "value": "STORAGE_SPACE"
            }
        ],

Regards