我正在部署CloudFoundry并在内部调用SoftLayer API来创建250GB的iSCSI磁盘,但会导致如下错误。
在类似的方法中,500GB磁盘创建导致错误,但创建20GB或1000GB是成功的。
是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 :(得分: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价格具有存储CApacity的限制,例如
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 GB的存储有效,因此这个价格适用于250 GB和500 GB的存储。您正在使用的过滤器是过滤这些值,在这种情况下,您必须更改过滤器以验证您的存储(在这种情况下为250GB)是否在此值范围之间,但无法使用Softlayer的过滤器来完成,因为filter的值是字符串而不是单个整数,例如:
"value": "100"
所以你需要将该值解析为整数,然后验证它是否在范围内(使用Softlayer的过滤器是不可能的)。
您当前过滤器正在使用其他值的原因是因为CAPACITY_RESTRICTION_MAX
和CAPACITY_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"
}
],
此致