【发布时间】:2016-05-10 20:14:22
【问题描述】:
基于这个问题的答案:
Error when using SoftLayer Ruby API to specific additional disks with a virtual server
我已将我的脚本转换为使用 placeOrder 并让它与单个磁盘一起工作,但我仍然坚持如何指定第二个磁盘。这段代码是我尝试指定两个磁盘:
#!/usr/bin/ruby
require 'softlayer_api'
client = SoftLayer::Client.new(username: 'USER', api_key: 'APIKEY')
productOrder = {
'virtualGuests' => [{
'hostname' => 'test',
'domain' => 'mycompany.com',
'primaryBackendNetworkComponent' => { 'networkVlan' => { 'id' => XXXXX } }
}],
'location' => XXXXX,
'packageId' => 46,
'imageTemplateId' => XXXXX,
'useHourlyPricing' => true,
'prices' => [
{'id' => 26125 }, # 1 x 2.0 GHz Core
{'id' => 32597 }, # 1 GB RAM
{'id' => 23065 }, # 100 GB (SAN)
{'id' => 23065 }, # 100 GB (SAN)
{'id' => 34183 }, # 0 GB Bandwidth
{'id' => 24713 }, # 1 Gbps Public & Private Network Uplinks
{'id' => 34807 }, # 1 IP Address
{'id' => 33483 }, # Unlimited SSL VPN Users & 1 PPTP VPN User per account
{'id' => 34241 }, # Host Ping and TCP Service Monitoring
{'id' => 32500 }, # Email and Ticket
{'id' => 35310 }, # NESSUS_VULNERABILITY_ASSESSMENT_REPORTING
{'id' => 23070 }, # REBOOT_REMOTE_CONSOLE
{'id' => 32627 } # AUTOMATED_NOTIFICATION
]
}
order = client['Product_Order'].verifyOrder(productOrder) here
但它会产生错误:
/usr/lib64/ruby/2.1.0/xmlrpc/client.rb:271:in `call': No disk categories available for price with id 23065. (XMLRPC::FaultException)
from /usr/lib64/ruby/gems/2.1.0/gems/softlayer_api-3.0.0/lib/softlayer/Service.rb:281:in `call_softlayer_api_with_params'
from /usr/lib64/ruby/gems/2.1.0/gems/softlayer_api-3.0.0/lib/softlayer/Service.rb:210:in `method_missing'
from ./slt:66:in `<main>'
如何为虚拟服务器指定订单中的第二个磁盘?
【问题讨论】: