软件层 捕获 VM 映像时出错"Connection reset by peer"



我使用 Softlayer python API 自动创建 VM 并将一些软件包安装到 VM,然后捕获 VM 映像。该代码在过去三年中一直有效。代码在 SoftLayer 内部的 VM 中运行。但是从昨天开始,在运行相同的代码时,我在图像捕获期间不断收到"对等方重置连接"。只是想知道 Softlayer 中是否有任何变化导致它?

错误: [Errno 104] 对等方重置连接

2017-03-31 14:37:03,096 - imaginator.cli-状态 - 错误 - 失败 | 映像构建过程中发生未知错误 - 有关详细信息,请参阅日志。

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 - 信息 - 开始新的 HTTPS 连接 (1):api.service.softlayer.com

2017-03-31 14:37:05,719 - imaginator.provider.softlayer - 信息 - 已提交销毁实例30219065的请求

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

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

您使用的代码行是正确的。方法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))   

问候

最新更新