2016-12-02 84 views
0

我正在调用vCPU和内存升级到hourlyVirtualGuest主机的集合。我发现,取决于我一次做多少次,某些请求无法完成而不会产生错误。hourlyVirtualGuests升级/降级响应丢弃

我目前的逻辑是发布10个升级/降级操作,然后睡一段时间。如果我在循环中睡了60秒,那么一切都很好。如果我把睡眠时间降低到30秒,所有请求都会被接受,但有几个不会完成。我可以使用睡眠值,但是这些请求的一部分在没有警报的情况下丢失是一个问题。我在某处溢出队列吗?

回答

0

这个问题很奇怪,您可以尝试将所有升级请求以单一顺序批量化并查看会发生什么情况。

placeOrder方法的容器有一个名为“orderContainers”的属性,您可以在其中设置升级订单列表。

看看这个例子使用的SoftLayer Python客户端,我加入以相同的顺序升级resquests:

""" 
Upgrade VSIs. 

Important manual pages: 
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order 
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. <[email protected]> 
""" 
import SoftLayer 
# For nice debug output: 
from pprint import pprint as pp 

# Your SoftLayer API username and key. 
USERNAME = 'set me' 
API_KEY = 'set me' 

virtualGuestId = 26252013 
virtualGuestId2 = 26252013 

# Setting the configuration for a upgrade a VM 
orderContainer = {} 
orderContainer['packageId'] = 46 
orderContainer['complexType'] = 'SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade' 
orderContainer['virtualGuests'] = [{'id': virtualGuestId}] 
orderContainer['prices'] = [ 
    # Upgraqdes prices 
    { 'id': 1644 } 
] 
orderContainer['properties'] = [{'name': 'MAINTENANCE_WINDOW', 'value': 'now'}] 

# Setting the configuration for a upgrade another VM 
orderContainer2 = {} 
orderContainer2['packageId'] = 46 
orderContainer2['complexType'] = 'SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade' 
orderContainer2['virtualGuests'] = [{'id': virtualGuestId2}] 
orderContainer2['prices'] = [ 
    # Upgraqdes prices 
    { 'id': 1644 } 
] 
orderContainer2['properties'] = [{'name': 'MAINTENANCE_WINDOW', 'value': 'now'}] 

#adding the upgrade orders to the container 
orderData = { 
    "orderContainers": [ 
     orderContainer, 
     orderContainer2 
    ], 
    'complexType': 'SoftLayer_Container_Product_Order' 
} 

print (orderData) 

orderClient = SoftLayer.Client(
    username=USERNAME, 
    api_key=API_KEY 
) 

try: 
    result = orderClient['Product_Order'].verifyOrder(orderData) 
    pp(result) 

except SoftLayer.SoftLayerAPIError as e: 
     pp('Unable to upgrade the VSI faultCode=%s, faultString=%s' 
      % (e.faultCode, e.faultString))#!/usr/bin/env python 

问候

+0

这很有趣。现在我试图玩这个想法,看看我可以在没有API对象的情况下按给定顺序接通多少升级请求。任何想法会有什么样的限制?我假设我无法一次完成50次升级。 – Gary

+0

作为一个额外的问题,“价格”属性是有问题的。有一种方法可以枚举给定DC中给定项目的这个值吗?看起来这个数字会根据你所在的DC而改变,所以可能有很多选择。 – Gary

+0

我不知道,我从来没有在一个订单中订购过这个金额,文件没有说明限制,所以你应该可以一次订购50个或更多的升级。 –