2017-03-03 80 views
0

是否可以直接將AWS圖像導入柔軟層?我知道我們可以將AWS鏡像和導入軟件下載到軟件中,但正在尋找一些自動化解決方案。將AWS圖像導入柔軟層

回答

2

沒有任何SoftLayer的API方法至極讓所有的proccess自動,圖像必須在你的任何對象存儲的賬號上傳你可以使用API​​的圖像出現在這裏上傳一些參考:

http://sldn.softlayer.com/blog/waelriac/Managing-SoftLayer-Object-Storage-Through-REST-APIs

,看看如何處理大文件

https://docs.openstack.org/developer/swift/overview_large_objects.html

本文檔一旦該文件已被上傳土特產品可以使用導入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. <[email protected]> 
""" 
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) 

問候

+0

好了,但沒有方法直接從SoftLayer的帳戶是指亞馬遜的AMI和SoftLayer的導入? – aaj

+0

正如我在回答中所表示的那樣:「沒有任何Softlayer的API方法會自動完成所有的過程」。 –