SoftLayer API 硬件:快速提供 BM 服务器预设配置 OS

SoftLayer API Hardware : Fast Provision of BM Server PresetConfiguration OS

使用 BM 服务器 REST 的快速配置 API:

http://sldn.softlayer.com/blog/bpotter/ordering-bare-metal-servers-using-softlayer-api

SoftLayer_Hardware/getCreateObjectOptions : 在响应中我们将获得固定的预设配置、数据中心、操作系统详细信息等,

当我使用 OS 参考代码 ESXI_5.1_64 进行配置时,出现以下错误。在请求中我没有提到 networkComponents 细节,如果我添加 "networkComponents": [{ "maxSpeed": 100 }], details 那么我也会得到下面提到的错误信息。

{
"error": "VMware ESXi 5.5 cannot be ordered with 100 Mbps Public & Private Network Uplinks"
"code": "SoftLayer_Exception_Public"
} 

此外,如果我使用一些操作系统参考代码,我会收到下面提到的错误。

{
"error": "Unable to match an OS with reference code: XENSERVER_6.0_64"
"code": "SoftLayer_Exception_NotFound"
}

 "operatingSystemReferenceCode": "XENSERVER_6.0_64"  "operatingSystemReferenceCode": "REDHAT_6_64"

1.异常:

{ "error": "VMware ESXi 5.5 cannot be ordered with 100 Mbps Public & Private Network Uplinks" "code": "SoftLayer_Exception_Public" }

原因:无法订购带有“100 Mbps Public 和专用网络上行链路”的 VMware OSes(例如 "networkComponents": [{ "maxSpeed": 100 } ]). VMware OSes 必须至少订购“1 Gbps Public 和专用网络上行链路”。 (例如 "networkComponents": [{ "maxSpeed": 1000}])。

2。异常:

{ "error": "Unable to match an OS with reference code: XENSERVER_6.0_64" "code": "SoftLayer_Exception_NotFound" }

可能您正在尝试订购按小时计费的服务器("hourlyBillingFlag":是),这可能是异常的原因,因为此OS仅适用于按月计费。

注意:如果这不是原因("hourlyBillingFlag":正确),您可以附上您正在尝试的代码,以便识别问题和提供更多关于它的反馈。

如何识别项目的计费类型?

使用 SoftLayer_Hardware::getCreateObjectOptions 方法,您将得到如下响应:

38:  {
"itemPrice": {
"hourlyRecurringFee": ".024"
"recurringFee": "17"
"item": {
"description": "Windows Server 2012 R2 Standard Edition (64 bit)"
}-
}-
"template": {
"operatingSystemReferenceCode": "WIN_2012-STD-R2_64"
}-
}

"hourlyRecurringFee" 表示该项目每小时可用,每月 "recurringFee"。 "XENSERVER_6.0_64" 项目仅适用于月份,因为它只有 "recurringFee" 属性 而不是 "hourlyRecurringFee"属性.

OS ESXI_5.1_64 对您配置的 fixedConfigurationPreset 无效(注意根据您的评论我假设您使用的是 S1270_8GB_2X1TBSATA_NORAID 您没有复制您的代码 :( )。对于该预设,有效的 OS 是 ESXI_5.5_64。(VMware ESXi 5.5)所以请尝试此代码:

{
    "parameters": [{
        "datacenter": {
            "name": "dal01"
        },
        "hostname": "vijvmware",
        "domain": "csc.com",
        "hourlyBillingFlag": false,
        "fixedConfigurationPreset": {
            "keyName": "S1270_8GB_2X1TBSATA_NORAID"
        },
        "operatingSystemReferenceCode": "ESXI_5.5_64",
        "networkComponents": [ 
         { 
             "maxSpeed": 10
         } 
       ]
    }]
}

请记住 SoftLayer_Hardware::getCreateObjectOptions returns 创建裸机的所有选项,但并非所有选项的约定都有效,这取决于您创建正确的配置为此,您可能会看到 UI(Softlayer 的门户)。