Softlayer API 发送SSD磁盘信息?

Softlayer API send SSD disk information?

如何在create_intance()订单中发送SSD盘的信息?

我看到在磁盘信息中你应该发送 disk/disks 的大小,但我想发送的信息是 disk/disks 应该是 SSD 而不是 HDD,这是默认的设置中的选项。

所以我设法找到了这个:

local disk(0)  25,100                                                                                    
local disk(2)  25,100,150,200,300

似乎唯一告诉我磁盘之间区别的标志是这个 0 和 2,但我怎么能把它发送到这里:

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

看来你需要在请求中添加flavor,调用方法http://sldn.softlayer.com/reference/services/softlayer_virtual_guest/getcreateobjectoptions

显示所有使用createObject方法订购VSI的有效配置

当我调用该方法时,我可以看到以下风格:

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

您需要选择更适合您的喜好并将模板添加到您的请求中,例如为您的要求添加风味:

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

正如您在选择 Balanced Local Storage 时提到的那样,磁盘是 SSD,因此您需要寻找名称中包含 BL 一词的 flavor,BL 代表 Balanced Local。