Amazon web services 将AWS图像导入softlayer

Amazon web services 将AWS图像导入softlayer,amazon-web-services,ibm-cloud-infrastructure,Amazon Web Services,Ibm Cloud Infrastructure,是否可以将AWS图像直接导入softlayer?我知道我们可以下载AWS图像并将其导入softlayer,但我们正在寻找一些自动化的解决方案。没有任何softlayer的API方法可以自动完成所有过程,图像必须上载到任何对象存储的帐户中。您可以使用API将图像上载到此处一些参考: 请参阅此文档,了解如何处理大型文件 上传文件后,tou可以使用API导入: 下面是使用SOftlayer的Python客户端的示例: """ Create Image Template from external

是否可以将AWS图像直接导入softlayer?我知道我们可以下载AWS图像并将其导入softlayer,但我们正在寻找一些自动化的解决方案。

没有任何softlayer的API方法可以自动完成所有过程,图像必须上载到任何对象存储的帐户中。您可以使用API将图像上载到此处一些参考:

请参阅此文档,了解如何处理大型文件

上传文件后,tou可以使用API导入:

下面是使用SOftlayer的Python客户端的示例:

"""
Create Image Template from external source

This script creates a transaction to import a disk image from an external source and create 
a standard image template

Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Virtual_Guest_Block_Device_Template_Configuration
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device_Template_Group

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

# Your SoftLayer username and apiKey
USERNAME = 'set me'
API_KEY = 'set me'

# Declare the group name to be applied to the imported template
name = 'imageTemplateTest'
# Declare the note to be applied to the imported template
note = 'This is for test Rcv'

'''
Declare referenceCode of the operating system software description for the imported VHD
available options: CENTOS_6_32, CENTOS_6_64, CENTOS_7_64, REDHAT_6_32, REDHAT_6_64, REDHAT_7_64, 
UBUNTU_12_32, UBUNTU_12_64, UBUNTU_14_32, UBUNTU_14_64, WIN_2003-STD-SP2-5_32, WIN_2003-STD-SP2-5_64, 
WIN_2008-STD-R2-SP1_64, WIN_2012-STD_64.
'''
operatingSystemReferenceCode = 'CENTOS_6_64'

'''
Define the parameters below, which refers to object storage where the image template is stored. 
It will help to build the uri.
'''
# Declare the object storage account name
objectStorageAccountName = 'SLOS307608-10'
# Declare the cluster name where the image is stored
clusterName = 'dal05'
# Declare the container name where the image is stored
containerName = 'OS'
# Declare the file name of the image stored in the object storage, it should be .vhd or 
fileName = 'testImage2.vhd-0.vhd'

"""
Creating an SoftLayer_Container_Virtual_Guest_block_Device_Template_Configuration Skeleton
which contains the information from external source
"""
configuration = {
    'name': name,
    'note': note,
    'operatingSystemReferenceCode': operatingSystemReferenceCode,
    'uri': 'swift://'+ objectStorageAccountName + '@' + clusterName + '/' + containerName + '/' + fileName
}

# Declare the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
groupService = client['SoftLayer_Virtual_Guest_Block_Device_Template_Group']

try:
    result = groupService.createFromExternalSource(configuration)
    print(result)
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to create the image template from external source. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
    exit(1)
“”“
从外部源创建图像模板
此脚本创建一个事务以从外部源导入磁盘映像并创建
标准图像模板
重要手册页:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Virtual_Guest_Block_Device_Template_Configuration
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device_Template_Group
许可证:http://sldn.softlayer.com/article/License
作者:SoftLayer Technologies,Inc。
"""
导入软层
#您的SoftLayer用户名和apiKey
用户名='设置我'
API_KEY='设置我'
#声明要应用于导入模板的组名
名称='imageTemplateTest'
#声明要应用于导入模板的注释
注='这是用于测试Rcv'
'''
为导入的VHD声明操作系统软件描述的引用代码
可用选项:CENTOS_6_32、CENTOS_6_64、CENTOS_7_64、REDHAT_6_32、REDHAT_6_64、REDHAT_7_64、,
UBUNTU_12_32,UBUNTU_12_64,UBUNTU_14_32,UBUNTU_14_64,WIN_2003-STD-SP2-5_32,WIN_2003-STD-SP2-5_64,
WIN_2008-STD-R2-SP1_64,WIN_2012-STD_64。
'''
operatingSystemReferenceCode='CENTOS_6_64'
'''
定义以下参数,这些参数指存储图像模板的对象存储。
这将有助于构建uri。
'''
#声明对象存储帐户名
objectStorageAccountName='SLOS307608-10'
#声明存储映像的群集名称
clusterName='dal05'
#声明存储图像的容器名称
containerName='OS'
#声明存储在对象存储器中的映像的文件名,该文件名应为.vhd或
文件名='testImage2.vhd-0.vhd'
"""
创建软层\容器\虚拟\来宾\块\设备\模板\配置框架
其中包含来自外部源的信息
"""
配置={
“名称”:名称,
“注意”:注意,
“operatingSystemReferenceCode”:operatingSystemReferenceCode,
'uri':'swift://'+objectStorageAccountName+'@'+clusterName+'/'+containerName+'/'+fileName
}
#声明API客户端
client=SoftLayer.client(用户名=用户名,api\U密钥=api\U密钥)
groupService=client['SoftLayer\u Virtual\u Guest\u Block\u Device\u Template\u Group']
尝试:
结果=groupService.createFromExternalSource(配置)
打印(结果)
除SoftLayer.SoftLayer外,错误为e:
打印(“无法从外部源创建图像模板。faultCode=%s,faultString=%s”%(e.faultCode,e.faultString))
出口(1)

关于

没有任何Softlayer的API方法可以自动完成所有过程,必须将图像上载到对象存储的任何帐户中。您可以使用API将图像上载到该帐户。此处有一些参考:

请参阅此文档,了解如何处理大型文件

上传文件后,tou可以使用API导入:

下面是使用SOftlayer的Python客户端的示例:

"""
Create Image Template from external source

This script creates a transaction to import a disk image from an external source and create 
a standard image template

Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Virtual_Guest_Block_Device_Template_Configuration
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device_Template_Group

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

# Your SoftLayer username and apiKey
USERNAME = 'set me'
API_KEY = 'set me'

# Declare the group name to be applied to the imported template
name = 'imageTemplateTest'
# Declare the note to be applied to the imported template
note = 'This is for test Rcv'

'''
Declare referenceCode of the operating system software description for the imported VHD
available options: CENTOS_6_32, CENTOS_6_64, CENTOS_7_64, REDHAT_6_32, REDHAT_6_64, REDHAT_7_64, 
UBUNTU_12_32, UBUNTU_12_64, UBUNTU_14_32, UBUNTU_14_64, WIN_2003-STD-SP2-5_32, WIN_2003-STD-SP2-5_64, 
WIN_2008-STD-R2-SP1_64, WIN_2012-STD_64.
'''
operatingSystemReferenceCode = 'CENTOS_6_64'

'''
Define the parameters below, which refers to object storage where the image template is stored. 
It will help to build the uri.
'''
# Declare the object storage account name
objectStorageAccountName = 'SLOS307608-10'
# Declare the cluster name where the image is stored
clusterName = 'dal05'
# Declare the container name where the image is stored
containerName = 'OS'
# Declare the file name of the image stored in the object storage, it should be .vhd or 
fileName = 'testImage2.vhd-0.vhd'

"""
Creating an SoftLayer_Container_Virtual_Guest_block_Device_Template_Configuration Skeleton
which contains the information from external source
"""
configuration = {
    'name': name,
    'note': note,
    'operatingSystemReferenceCode': operatingSystemReferenceCode,
    'uri': 'swift://'+ objectStorageAccountName + '@' + clusterName + '/' + containerName + '/' + fileName
}

# Declare the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
groupService = client['SoftLayer_Virtual_Guest_Block_Device_Template_Group']

try:
    result = groupService.createFromExternalSource(configuration)
    print(result)
except SoftLayer.SoftLayerAPIError as e:
    print("Unable to create the image template from external source. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
    exit(1)
“”“
从外部源创建图像模板
此脚本创建一个事务以从外部源导入磁盘映像并创建
标准图像模板
重要手册页:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Virtual_Guest_Block_Device_Template_Configuration
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest_Block_Device_Template_Group
许可证:http://sldn.softlayer.com/article/License
作者:SoftLayer Technologies,Inc。
"""
导入软层
#您的SoftLayer用户名和apiKey
用户名='设置我'
API_KEY='设置我'
#声明要应用于导入模板的组名
名称='imageTemplateTest'
#声明要应用于导入模板的注释
注='这是用于测试Rcv'
'''
为导入的VHD声明操作系统软件描述的引用代码
可用选项:CENTOS_6_32、CENTOS_6_64、CENTOS_7_64、REDHAT_6_32、REDHAT_6_64、REDHAT_7_64、,
UBUNTU_12_32,UBUNTU_12_64,UBUNTU_14_32,UBUNTU_14_64,WIN_2003-STD-SP2-5_32,WIN_2003-STD-SP2-5_64,
WIN_2008-STD-R2-SP1_64,WIN_2012-STD_64。
'''
operatingSystemReferenceCode='CENTOS_6_64'
'''
定义以下参数,这些参数指存储图像模板的对象存储。
这将有助于构建uri。
'''
#声明对象存储帐户名
objectStorageAccountName='SLOS307608-10'
#声明存储映像的群集名称
clusterName='dal05'
#声明存储图像的容器名称
containerName='OS'
#声明存储在对象存储器中的映像的文件名,该文件名应为.vhd或
文件名='testImage2.vhd-0.vhd'
"""
创建软层\容器\虚拟\来宾\块\设备\模板\配置框架
其中包含来自外部源的信息
"""
配置={
“名称”:名称,
“注意”:注意,
“operatingSystemReferenceCode”:operatingSystemReferenceCode,
'uri':'swift://'+objectStorageAccountName+'@'+clusterName+'/'+containerName+'/'+fileName
}
#声明API客户端
client=SoftLayer.client(用户名=用户名,api\U密钥=api\U密钥)
groupService=client['SoftLayer\u Virtual\u Guest_