hourlyVirtualGuests升级/降级响应已下降

时间:2016-12-02 09:48:45

标签: ibm-cloud-infrastructure

我正在调用vCPU和内存升级到hourlyVirtualGuest主机的集合。我发现,根据我一次做多少,一些请求无法完成而不会产生错误。

我目前的逻辑是发布10次升级/降级操作,然后再睡一段时间。如果我在循环中睡了60秒,那么一切都很好。如果我将睡眠时间降至30秒,则会接受所有请求,但有几个请求无法完成。我可以使用睡眠值,但是这些请求的子集在没有警报的情况下被丢弃的事实是一个问题。我在某个地方溢出了队列吗?

1 个答案:

答案 0 :(得分:0)

问题很奇怪,您可以尝试在一个订单中批量处理所有升级请求,看看会发生什么。

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

使用Softlayer Python客户端查看此示例,我将以相同的顺序添加到升级请求中:

"""
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. <sldn@softlayer.com>
"""
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

此致