我想實現使用Softlayer java API的loadFromImage函數。當我在control.softlayer.com上測試時,一個私人圖像沒有被列出。 我需要首先將私人圖像加載到我的服務器嗎? 然後,在服務器上加載圖像?如果不是,你能指導我正確的程序嗎?我可以有任何示例代碼來實現嗎?從Softlayer中的私人圖像加載
謝謝 邁克
我想實現使用Softlayer java API的loadFromImage函數。當我在control.softlayer.com上測試時,一個私人圖像沒有被列出。 我需要首先將私人圖像加載到我的服務器嗎? 然後,在服務器上加載圖像?如果不是,你能指導我正確的程序嗎?我可以有任何示例代碼來實現嗎?從Softlayer中的私人圖像加載
謝謝 邁克
目前,您沒有在您的帳戶中的任何「私人形象」,請參閱控制門戶網站,以確認這一點:
(按「私密圖片」過濾)
從門戶網站創建一個新的形象:
API的例子:
同時爲API,我將提供一些休息的請求,可以幫助你:
URL:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/5464742/createArchiveTransaction.json
Method: POST
Json:
*-----------------------
{
"parameters": [
"my-new-standard-image-name ",
[
{
"id": 6862924,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
],
"api note"
]
}
*-----------------------
where:
" my-new-standard-image-name " is the group name for the archive
"6862924" A computing instance block device's unique ID
"api note" is A long note describing the image template
"5464742" is the id of virtual server
如何獲取「塊設備的唯一ID」?
Please, execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[Virtual_Guest_ID]/getBlockDevices?objectFilter={"blockDevices":{"bootableFlag":{"operation": "1"}}}&objectMask=mask[id]
執行「SoftLayer_Virtual_Guest :: createArchiveTransaction」新的事務將在服務器中創建後,請至結束,等待幾分鐘。
參考:http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createArchiveTransaction
網址:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[Virtual_Guest_ID]/reloadOperatingSystem
方法:POST
Json:
*----------------------------
{
"parameters": [
"f610b52f9fce12ef4fc37d6e9f5fe77a",
{
"imageTemplateId": 931371
}
]
}
*----------------------------
其中:
「f610b52f9fce12ef4fc37d6e9f5fe77a」 is the token (The token will remain active for 10 minutes)
「931371」 the image template to use
但是,如何讓我們的上述配置的令牌?
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[Virtual_Guest_ID]/reloadOperatingSystem
Method: GET
參考文獻:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/reloadOperatingSystem http://knowledgelayer.softlayer.com/learning/introduction-image-templates http://knowledgelayer.softlayer.com/faq/what-standard-image-template http://knowledgelayer.softlayer.com/faq/what-flex-image http://knowledgelayer.softlayer.com/procedure/create-standard-image http://knowledgelayer.softlayer.com/procedure/create-flex-image
問候。
感謝您的解釋。 :) –
我還有2個問題。 BootfromImage和LoadfromImage之間的功能區別是什麼?如果我們使用ftp將自己的映像上傳到本地磁盤,我們可以使用這兩個函數重新加載映像嗎? –
本文檔可爲您提供幫助:https://knowledgelayer.softlayer.com/faqs/5#1130 https://knowledgelayer.softlayer.com/faqs/5 – mcruz
你是否已經將圖像添加到圖像管理器? http://knowledgelayer.softlayer.com/procedure/import-image – underscorephil