Softlayer在捕获VM映像时出现“通过对等方重置连接”错误

时间:2017-03-31 17:20:39

标签: python ibm-cloud-infrastructure

我使用Softlayer python API自动创建VM并将一些软件包安装到VM,然后捕获VM映像。该代码工作了三年。代码在Softlayer内的VM中运行。但是自从昨天开始运行相同的代码时,我在图像捕获过程中不断获得“通过对等方重置连接”。只是想知道Softlayer中是否有任何改变导致它?

  

错误:[Errno 104]由同行重置连接

     

2017-03-31 14:37:03,096 - imaginator.cli-Status - ERROR - 失败|   图像构建期间发生了未知错误 - 有关详细信息,请参阅日志。

     

2017-03-31 14:37:03,097 - SoftLayer.transports - INFO - POST   https://api.service.softlayer.com/xmlrpc/v3/SoftLayer_Virtual_Guest

     

2017-03-31 14:37:03,097 - urllib3.connectionpool - INFO - 开始新的   HTTPS连接(1):api.service.softlayer.com

     

2017-03-31 14:37:05,719 - imaginator.provider.softlayer - INFO -   提交破坏实例30219065的请求

我用来捕捉图像的代码是:

transactionInfo = self.client['Virtual_Guest'].createArchiveTransaction(name, disks, groupName, id=server.id)

1 个答案:

答案 0 :(得分:2)

您使用的代码行是正确的。方法createArchiveTransaction()按预期工作,我可以使用下面的代码示例创建图像模板。

目前,Softlayer的API服务器存在一些与“由同行重置连接”相关的问题,SoftLayer正在努力解决这些问题。一些用户报告说这是暂时的,我建议在一段时间后再试一次。

代码示例:

"""
Create image template.

The script creates a standard image template, it makes a call to the SoftLayer_Virtual_Guest::createArchiveTransaction method
sending the IDs of the disks in the request.
For more information please see below.

Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest
https://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createArchiveTransaction
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device

License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer

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

# The virtual guest ID you want to create a template
virtualGuestId = 29292929
# The name of the image template
groupName = 'my image name'
# An optional note for the image template
note = 'an optional note'

"""
Build a skeleton SoftLayer_Virtual_Guest_Block_Device object
containing the disks you want to the image.
In this case we are going take an image template of 2 disks
from the virtual machine.
"""
blockDevices = [
    {
        "id": 45009433,
        "complexType": "SoftLayer_Virtual_Guest_Block_Device"
    },
    {
        "id": 45009439,
        "complexType": "SoftLayer_Virtual_Guest_Block_Device"
    }
]

# Declare a new API service object
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)

try:
    # Creating the transaction for the image template
   response = client['SoftLayer_Virtual_Guest'].createArchiveTransaction(groupName, blockDevices, note, id=virtualGuestId)
    print(response)
except SoftLayer.SoftLayerAPIError as e:
    """
    # If there was an error returned from the SoftLayer API then bomb out with the
    # error message.
    """
    print("Unable to create the image template. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))   

问候,