简体   繁体   English

捕获VM映像时,Softlayer获得“对等连接重置”错误

[英]Softlayer Got “Connection reset by peer” error when capturing a VM image

I use the Softlayer python API to automate create a VM and install some packages to the VM, then capture the VM image. 我使用Softlayer python API自动创建VM,并将某些软件包安装到VM,然后捕获VM映像。 The code worked for the last three years. 该代码在过去三年中一直有效。 The code runs in a VM inside Softlayer. 该代码在Softlayer内部的VM中运行。 But I kept getting "Connection reset by peer" during image capturing when running the same code since yesterday. 但是从昨天开始,运行相同的代码时,在图像捕获过程中一直出现“对等连接重置”的情况。 Just wondering if anything has changed in Softlayer that causing it? 只是想知道Softlayer中是否有任何变化导致了它?

error: [Errno 104] Connection reset by peer 错误:[Errno 104]对等重置连接

2017-03-31 14:37:03,096 - imaginator.cli-Status - ERROR - Failed | 2017-03-31 14:37:03,096-imaginator.cli-Status-错误-失败| Unknown errors occurred during image building - see log for details. 映像生成期间发生未知错误-有关详细信息,请参见日志。

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-SoftLayer.transports-信息-POST https://api.service.softlayer.com/xmlrpc/v3/SoftLayer_Virtual_Guest

2017-03-31 14:37:03,097 - urllib3.connectionpool - INFO - Starting new HTTPS connection (1): api.service.softlayer.com 2017-03-31 14:37:03,097-urllib3.connectionpool-信息-启动新的HTTPS连接(1):api.service.softlayer.com

2017-03-31 14:37:05,719 - imaginator.provider.softlayer - INFO - Submitted request to destroy instance 30219065 2017-03-31 14:37:05,719-imaginator.provider.softlayer-信息-提交的销毁实例30219065的请求

The code I used to capture the image is: 我用来捕获图像的代码是:

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

The code line you are using is correct. 您使用的代码行是正确的。 The method createArchiveTransaction() is working as expected, I was able to create an image template using the code example below. 方法createArchiveTransaction()可以正常工作,我能够使用下面的代码示例创建图像模板。

Currently, there are some issues in Softlayer's API server related to “connection reset by peer” and SoftLayer is working to resolve them. 当前,Softlayer的API服务器中存在一些与“对等连接重置”有关的问题 ,SoftLayer致力于解决这些问题。 Some users reported that this is temporal, I suggest to try it again after a while. 一些用户报告说这是暂时的,我建议过一会再试一次。

Code example: 代码示例:

"""
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))   

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM