我需要一个解决方案如何在softlayer中使用静态IP启动虚拟机,我在许多站点搜索仍然无法得到任何答案静态IP由softlayer支持并想知道在softlayer中订购静态IP的方法是什么以及如何干扰虚拟机
高级谢谢你的回答......
答案 0 :(得分:0)
为了订购具有任何规格的虚拟客人,您应该获得正确的商品价格ID,为此您可以运行下一个请求:
https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/46/getItemPrices.json
Method: GET
获得商品价格ID后,您可以使用它们来验证/下达具有您所需特征的订单,这里是一个使用静态IPv4订购VSI的示例:
https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder.json
Method: POST
Body:
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Virtual_Guest",
"quantity": 1,
"virtualGuests": [
{"hostname": "test-template", "domain": "example.com"}
],
"location": 168642,
"packageId": 46,
"prices": [
{"id": 1640},
{"id": 1644},
{"id": 905},
{"id": 272},
{"id":50231},
{"id": 21},
{"id": 2202},
{"id":13945},
{"id": 55},
{"id": 57},
{"id": 58},
{"id": 420},
{"id": 418},
{"id": 22}
]
}
]
}
此外,您可以使用此文档记录的python脚本,并描述静态IPv4的REST请求中使用的每个项目价格ID: 注意:该脚本使用SL python客户端https://github.com/softlayer/softlayer-python
"""
Order Virtual Guest with Static IPv4.
Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
from pprint import pprint as pp
USERNAME = 'set me
API_KEY = 'set me
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest',
'quantity': 1,
'virtualGuests': [
{'hostname': 'test-template', 'domain': 'example.com'}
],
'location': 168642, # San Jose 1
'packageId': 46, # CCI Package
'prices': [
{'id': 1640}, # 1 x 2.0 GHz Core
{'id': 1644}, # 1 GB RAM
{'id': 905}, # Reboot / Remote Console
{'id': 272}, # 10 Mbps Public & Private Networks
{'id':50231}, # 1000 GB Bandwidth
{'id': 21}, # 1 IP Address
{'id': 2202}, # 25 GB (SAN)
{'id':13945}, # CentOS 6.x - Minimal Install (64 bit)
{'id': 55}, # Host Ping Monitoring
{'id': 57}, # Email and Ticket Notifications
{'id': 58}, # Automated Notification Response
{'id': 420}, # Unlimited SSL VPN Users & 1 PPTP VPN User per account
{'id': 418}, # Nessus Vulnerability Assessment & Reporting
{'id': 22} # 4 Public IP Addresses
]
}
try:
# Replace verifyOrder for placeOrder
result = client['SoftLayer_Product_Order'].verifyOrder(order)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to verify/place order faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
这是一个使用静态IPv6订购VSI的示例:
https:// $username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder.json
Method: POST
Body:
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Virtual_Guest",
"quantity": 1,
"virtualGuests": [
{"hostname": "test-template", "domain": "example.com"}
],
"location": 168642,
"packageId": 46,
"prices": [
{"id": 1640},
{"id": 1644},
{"id": 905},
{"id": 272},
{"id":50231},
{"id": 21},
{"id": 2202},
{"id":13945},
{"id": 55},
{"id": 57},
{"id": 58},
{"id": 420},
{"id": 418},
{"id": 17129},
{"id": 1481}
]
}
]
}
此外,您可以使用此文档记录的python脚本,并描述REST请求中用于静态IPv6的每个项目价格ID: 注意:该脚本使用SL python客户端https://github.com/softlayer/softlayer-python
"""
Order Virtual Guest with Static IPv6.
Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
from pprint import pprint as pp
USERNAME = 'set me
API_KEY = 'set me
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest',
'quantity': 1,
'virtualGuests': [
{'hostname': 'test-template', 'domain': 'example.com'}
],
'location': 168642, # San Jose 1
'packageId': 46, # CCI Package
'prices': [
{'id': 1640}, # 1 x 2.0 GHz Core
{'id': 1644}, # 1 GB RAM
{'id': 905}, # Reboot / Remote Console
{'id': 272}, # 10 Mbps Public & Private Networks
{'id':50231}, # 1000 GB Bandwidth
{'id': 21}, # 1 IP Address
{'id': 2202}, # 25 GB (SAN)
{'id':13945}, # CentOS 6.x - Minimal Install (64 bit)
{'id': 55}, # Host Ping Monitoring
{'id': 57}, # Email and Ticket Notifications
{'id': 58}, # Automated Notification Response
{'id': 420}, # Unlimited SSL VPN Users & 1 PPTP VPN User per account
{'id': 418}, # Nessus Vulnerability Assessment & Reporting
{'id':17129}, # 1_IPV6_ADDRESS
{'id': 1481} # 64_BLOCK_STATIC_PUBLIC_IPV6_ADDRESSES ]
}
try:
# Replace verifyOrder for placeOrder
result = client['SoftLayer_Product_Order'].verifyOrder(order)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to verify/place order faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))