Softlayer-使用此方法需要模板来宾记录

时间:2016-05-12 13:14:31

标签: rest ibm-cloud-infrastructure

我正在使用postman REST客户端来执行softlayer REST API's。当前尝试创建vm的快照

我收到错误,

  

“使用此方法需要模板访客记录”

执行以下休息呼叫时:

https://[username]:[api-key]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtual_guest_id]/
使用下面的文件在表单数据中

createArchiveTransaction.json

{
"parameters":[
"my-new-standard-image-name ",
[
{
"id": 6862924,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
],
"api note"
]
}

任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

按照以下步骤从Virtual Guest创建图像。

1从虚拟访客获取阻止设备

以下Rest请求将有助于它:

https://[username]:[api-key]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/22334455/getBlockDevices?objectMask=mask[diskImage[name, description]]

Method: Get

22334455 替换为您的VSI ID。

你会得到这样的结果:

[
  {
    "bootableFlag": 1,
    "createDate": "2015-09-21T15:20:27-03:00",
    "device": "0",
    "diskImageId": 10629873,
    "guestId": 22334455,
    "hotPlugFlag": 0,
    "id": 11223344,
    "modifyDate": "2015-10-19T13:25:53-03:00",
    "mountMode": "RW",
    "mountType": "Disk",
    "statusId": 1,
    "uuid": "c1d1d92a-42ee-cdef-47sdfsf3543456e1e17",
    "diskImage": {
      "description": "test.softlayer.com",
      "name": "test.softlayer.com"
    }
  },
  {
    "bootableFlag": 0,
    "createDate": "2015-10-19T13:24:58-03:00",
    "device": "1",
    "diskImageId": 11277111,
    "guestId": 22334455,
    "hotPlugFlag": 0,
    "id": 111122233,
    "modifyDate": null,
    "mountMode": "RW",
    "mountType": "Disk",
    "statusId": 1,
    "uuid": "38987d23-8395-aasdfsdf23434a602",
    "diskImage": {
      "description": "22334455-SWAP",
      "name": "22334455-SWAP"
    }
  },
  {
    "bootableFlag": 1,
    "createDate": "2015-09-21T15:20:42-03:00",
    "device": "3",
    "diskImageId": null,
    "guestId": 22334455,
    "hotPlugFlag": 1,
    "id": 33445566,
    "modifyDate": "2015-10-19T13:31:35-03:00",
    "mountMode": "RO",
    "mountType": "CD",
    "statusId": 1,
    "uuid": "4b3e59af-ed6a-3c96-sfsdf234a4aa708ff"
  }
]

2创建图片模板

确保不包括交换分区和CD挂载。

https://[username]:[api-key]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/22334455/createArchiveTransaction

Method: Post

{  
   "parameters":[  
      "testGroupNameRcv",
      [  
         {  
            "id":11223344
         }
      ],
      "Note for test"
   ]
}

11223344 22334455 替换为您的虚拟访客及其阻止设备中的标识符

参考文献: