Softlayer API发送SSD磁盘信息?

时间:2017-09-27 14:04:53

标签: python api ibm-cloud-infrastructure

如何在create_intance()命令期间发送SSD磁盘的信息?

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

所以我设法找到了这个:

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

1 个答案:

答案 0 :(得分:2)

您似乎需要在请求中添加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"
                }
            }
        },

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

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

正如您在选择平衡本地存储时所提到的那样,磁盘是SSD,因此您需要查找名称中包含单词BL的风格,它代表Balanced Local。