Reputation: 352
When I used SoftLayer API to create CCI using flavor which specific CPU, ram and first disk, I could not attach the second disk as before.
And I paste process details:
create CCI by createObject and parameters is below:
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest.json
{
"parameters": [
{
"blockDeviceTemplateGroup": {
"globalIdentifier": "2aae2a36-76f3-4d2f-9881-e86fa15b040b"
},
"datacenter": {
"name": "dc02"
},
"dedicatedAccountHostOnlyFlag": false,
"domain": "softlayer.com",
"hostname": "server-ed-20171108-032526-888",
"hourlyBillingFlag": true,
"localDiskFlag": false,
"networkComponents": [
{
"maxSpeed": 100
}
],
"primaryBackendNetworkComponent": {
"networkVlan": {
"id": 12345678,
"networkSpace": "PRIVATE"
}
},
"primaryNetworkComponent": {
"networkVlan": {
"id": 12345676,
"networkSpace": "PUBLIC"
}
},
"privateNetworkOnlyFlag": false,
"supplementalCreateObjectOptions": {
"flavorKeyName": "B1_4X8X25"
}
}
]
}
Wait for provision finish
Request SoftLayer_Product_Package objects for placing order
GET https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vmid}.json?objectMask=mask%5BprimaryBackendNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%2C+primaryNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%5D
Softlayer returns two packages(I used firstly)
[
{
"description": "Virtual Server Instance",
"id": 46,
"isActive": 1,
"name": "Cloud Server",
"type": {
"keyName": "VIRTUAL_SERVER_INSTANCE"
}
},
{
"description": "Public Virtual Server",
"id": 835,
"isActive": 1,
"name": "Public Virtual Server",
"type": {
"keyName": "VIRTUAL_SERVER_INSTANCE"
}
}
]
Request SoftLayer_Virtual_Guest getUpgradeItemPrices for finding upgrade item price for the second disk
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vmid}/getUpgradeItemPrices.json
And get 167 item prices and choice first item match categoryCode and capacity.
Place order
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder.json
Parameters:
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade",
"packageId": 46,
"prices": [
{
"categories": [
{
"categoryCode": "guest_disk1",
"id": 82,
"name": "Second Disk",
"quantityLimit": 0
}
],
"currentPriceFlag": false,
"hourlyRecurringFee": 0.013,
"id": 112953,
"item": {
"attributes": [
{
"attributeType": {
"keyName": "SAN_DISK",
"name": "SAN Disk"
},
"id": 196,
"itemAttributeTypeId": 50,
"itemId": 922,
"value": "1"
}
],
"capacity": 100,
"description": "100 GB (SAN)",
"id": 922,
"itemTaxCategoryId": 166,
"keyName": "GUEST_DISK_100_GB_SAN_3",
"localDiskFlag": false,
"units": "GB"
},
"itemId": 922,
"laborFee": 0,
"locationGroupId": 505,
"oneTimeFee": 0,
"pricingLocationGroup": {
"description": "Location Group 3",
"id": 505,
"locationGroupType": {
"name": "PRICING"
},
"locationGroupTypeId": 82,
"locations": [
{
"id": 449600,
"longName": "Mexico 1",
"name": "mex01",
"statusId": 2
},
{
"id": 2124095,
"longName": "London 6",
"name": "lon06",
"statusId": 2
},
{
"id": 167094,
"longName": "London 1",
"name": "lon01",
"statusId": 2
},
{
"id": 358694,
"longName": "London 2",
"name": "lon02",
"statusId": 2
},
{
"id": 2017395,
"longName": "London 4",
"name": "lon04",
"statusId": 2
},
{
"id": 1541257,
"longName": "Oslo 1",
"name": "osl01",
"statusId": 2
}
],
"name": "Location Group 3"
},
"recurringFee": 7.98,
"setupFee": 0,
"sort": 0
}
],
"properties": [
{
"name": "MAINTENANCE_WINDOW",
"value": "2017-11-08T03:34:12Z"
},
{
"name": "NOTE_GENERAL",
"value": "Upgrade instance configuration."
}
],
"virtualGuests": [
{
"id": {vmid}
}
]
},
false
]
}
This request get error with Response: {"error":"Invalid data on the order for property: packageId. Package (835) requires a preset configuration.","code":"SoftLayer_Exception_Order_InvalidData"}
The request is that I used package '46' to upgrade, but Softlayer return error about package '835'. What is that meaning?
Upvotes: 0
Views: 123
Reputation: 4386
try adding the property "presetId" in your request with a value = 0, also the packageId set it to 0. e.g.
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder.json
Parameters:
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade",
"packageId": 0,
"presetId": 0,
"prices": [
{
"categories": [
{
"categoryCode": "guest_disk1",
"id": 82,
"name": "Second Disk",
"quantityLimit": 0
}
],
"currentPriceFlag": false,
"hourlyRecurringFee": 0.013,
"id": 112953,
"item": {
"attributes": [
{
"attributeType": {
"keyName": "SAN_DISK",
"name": "SAN Disk"
},
"id": 196,
"itemAttributeTypeId": 50,
"itemId": 922,
"value": "1"
}
],
"capacity": 100,
"description": "100 GB (SAN)",
"id": 922,
"itemTaxCategoryId": 166,
"keyName": "GUEST_DISK_100_GB_SAN_3",
"localDiskFlag": false,
"units": "GB"
},
"itemId": 922,
"laborFee": 0,
"locationGroupId": 505,
"oneTimeFee": 0,
"pricingLocationGroup": {
"description": "Location Group 3",
"id": 505,
"locationGroupType": {
"name": "PRICING"
},
"locationGroupTypeId": 82,
"locations": [
{
"id": 449600,
"longName": "Mexico 1",
"name": "mex01",
"statusId": 2
},
{
"id": 2124095,
"longName": "London 6",
"name": "lon06",
"statusId": 2
},
{
"id": 167094,
"longName": "London 1",
"name": "lon01",
"statusId": 2
},
{
"id": 358694,
"longName": "London 2",
"name": "lon02",
"statusId": 2
},
{
"id": 2017395,
"longName": "London 4",
"name": "lon04",
"statusId": 2
},
{
"id": 1541257,
"longName": "Oslo 1",
"name": "osl01",
"statusId": 2
}
],
"name": "Location Group 3"
},
"recurringFee": 7.98,
"setupFee": 0,
"sort": 0
}
],
"properties": [
{
"name": "MAINTENANCE_WINDOW",
"value": "2017-11-08T03:34:12Z"
},
{
"name": "NOTE_GENERAL",
"value": "Upgrade instance configuration."
}
],
"virtualGuests": [
{
"id": {vmid}
}
]
},
false
]
}
let me know if that fix your issue.
Upvotes: 1