2017-03-10 74 views
0

我正在部署CloudFoundry并在内部调用SoftLayer API来创建250GB iSCSI磁盘,但会导致如下错误。
以类似的方法,创建500GB磁盘出错,但20GB或1000GB创建成功。SoftLayer对象存储API:创建250GB/500GB块存储失败。 20GB或1000GB都OK

是SoftLayer API问题还是我的环境改变了一些价目表?

{"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":""} 
******************** 

回答

0

简短的回答是,你需要使用1000,而不是250或500的这个请求,如果你想继续使用相同的筛选器:

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的过滤器来获取这些值,并且您将需要使用自己的代码来过滤这些值,这是因为IOPS价格具有存储容量的限制,例如

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" 
      } 
     ], 

在上述结果可以看到瓦莱斯CAPACITY_RESTRICTION_MAX

CAPACITY_RESTRICTION_MIN这些价值观意味着价格的有效期为100个GB的存储,以1000个GBS,所以这个价格还是不错的250个GB的储存和500GB。您正在使用的过滤器正在过滤这些值,因此您必须更改过滤器以验证您的存储(本例中为250GB)是否在此范围的值之间,但不能使用Softlayer的过滤器完成,因为值过滤器是字符串,而不是一个整数如:

"value": "100" 

所以,你需要分析该值整数,然后验证它是否为范围(使用Softlayer's过滤器这是不可能的)。

当前过滤器为其他值工作的原因是因为CAPACITY_RESTRICTION_MAXCAPACITY_RESTRICTION_MIN具有相同的值,例如

"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" 
      } 
     ], 

问候

+0

嗨尼尔森太谢谢你了! 你详细的解释让我明白了为什么250GB失败,为什么1000GB成功。 –