问题
How can I send the information of a SSD disk during the create_intance() order?
I see that in the disk information you should send the size of the disk/disks, but I want to send the information that the disk/disks should be SSD and not HDD, that is the default option in the setup.
So I manage to find this:
local disk(0) 25,100
local disk(2) 25,100,150,200,300
It seems that the only flag that tells me the difference between disks is this 0 and 2, but how can I send this in here:
new_vsi = {
'domain': u'test01.labs.sftlyr.ws',
'hostname': u'multi-test',
'datacenter': u'hkg02',
'dedicated': False,
'private': False,
'cpus': 1,
'os_code' : u'UBUNTU_LATEST',
'hourly': True,
'ssh_keys': [87634],
'disks': ('100',),
'local_disk': True,
'memory': 1024,
'tags': 'test, pleaseCancel',
'public_security_groups': [12, 15]
}
回答1:
It seems that you need to add the flavor in your request, all the valid configurations to order the VSI using the createObject method are displayed by calling the method http://sldn.softlayer.com/reference/services/softlayer_virtual_guest/getcreateobjectoptions
when I call that method I can see the following flavor:
"flavor": {
"keyName": "BL1_2X4X100",
"name": "BL1.2x4x200",
"configuration": [
{
"category": {
"name": "Computing Instance"
},
"price": {
"hourlyRecurringFee": ".045",
"recurringFee": "29.86",
"item": {
"description": "2 x 2.0 GHz Cores"
}
}
},
{
"category": {
"name": "First Disk"
},
"price": {
"hourlyRecurringFee": ".006",
"recurringFee": "3.98",
"item": {
"description": "100 GB (LOCAL)"
}
}
},
{
"category": {
"name": "RAM"
},
"price": {
"hourlyRecurringFee": ".054",
"recurringFee": "35.51",
"item": {
"description": "4 GB"
}
}
},
{
"category": {
"name": "Second Disk"
},
"price": {
"hourlyRecurringFee": ".012",
"recurringFee": "7.96",
"item": {
"description": "200 GB (LOCAL)"
}
}
},
{
"category": {
"name": "Fifth Disk"
},
"price": {
"hourlyRecurringFee": "0",
"recurringFee": "0",
"item": {
"description": "None"
}
}
},
{
"category": {
"name": "Second Disk"
},
"price": {
"hourlyRecurringFee": ".006",
"recurringFee": "3.98",
"item": {
"description": "100 GB (LOCAL)"
}
}
},
{
"category": {
"name": "Third Disk"
},
"price": {
"hourlyRecurringFee": "0",
"recurringFee": "0",
"item": {
"description": "None"
}
}
},
{
"category": {
"name": "Fourth Disk"
},
"price": {
"hourlyRecurringFee": "0",
"recurringFee": "0",
"item": {
"description": "None"
}
}
}
],
"totalMinimumHourlyFee": "0.111",
"totalMinimumRecurringFee": "73.33"
},
"template": {
"id": null,
"supplementalCreateObjectOptions": {
"flavorKeyName": "BL1_2X4X100"
}
}
},
you need to pick the favlor more suitable for you and add the template to your request e.g. to adding the flavor to your request:
new_vsi = {
'domain': u'test01.labs.sftlyr.ws',
'hostname': u'multi-test',
'datacenter': u'hkg02',
'dedicated': False,
'private': False,
'cpus': 1,
'os_code' : u'UBUNTU_LATEST',
'hourly': True,
'ssh_keys': [87634],
'disks': ('100',),
'local_disk': True,
'memory': 1024,
'tags': 'test, pleaseCancel',
'public_security_groups': [12, 15],
"supplementalCreateObjectOptions": {
"flavorKeyName": "BL1_2X4X100"
}
}
As you mentionated when you pick Balanced Local Storage the disk are SSD, so you need to look for the flavors whose name contains the word BL which stands for Balanced Local.
来源:https://stackoverflow.com/questions/46449988/softlayer-api-send-ssd-disk-information