从Softlayer中的私有Image加载

时间:2016-02-03 07:40:03

标签: ibm-cloud-infrastructure

我正在尝试使用Softlayer java API实现loadFromImage函数。当我在control.softlayer.com上测试时,没有列出私有图像。 我是否需要先将私有映像加载到我的服务器? 然后,在服务器上加载图像?如果没有,你能指导我正确的程序吗?我可以提供任何示例代码吗?

谢谢 麦克

Load From Image Page

1 个答案:

答案 0 :(得分:1)

目前,您的帐户中没有任何“私有图片”,请在控制门户中查看以确认:

  

https://control.softlayer.com/devices/images

(按“私人图片”过滤)

从门户网站创建新图片:

  • 转到https://control.softlayer.com/devices
  • 从列表中选择服务器
  • 准备好“设备列表”窗口后,从“操作”右侧菜单中选择“创建图像模板”。将创建标准图像。此图片将列在您的私人图片中。

API示例:

同时对于API,我将提供一些可能对您有帮助的REST请求:

  • 要创建新的标准图片,请执行:

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

  • 如何通过API从图片加载?

URL:

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

问候。