问题描述
我正在使用邮递员REST客户端执行softlayer REST API's
.current,试图创建虚拟机快照
I am using postman REST client to execute softlayer REST API's
.current trying to create snapshot of vm
我遇到错误,
在执行以下rest调用时:
when executing below rest call:
https://[username]:[api-key]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtual_guest_id]/
使用以下文件的表单数据createArchiveTransaction.json
:
in form data using below filecreateArchiveTransaction.json
:
{
"parameters":[
"my-new-standard-image-name ",
[
{
"id": 6862924,
"complexType": "SoftLayer_Virtual_Guest_Block_Device"
}
],
"api note"
]
}
有人可以帮助我解决这个问题吗?
Can anyone help me with this issue?
推荐答案
请按照以下步骤从Virtual Guest创建图像.
Follow these steps to create an image from Virtual Guest.
1从虚拟访客获取阻止设备
以下Rest请求将对此有所帮助:
The following Rest request will help with it:
https://[username]:[api-key]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/22334455/getBlockDevices?objectMask=mask[diskImage[name, description]]
Method: Get
用您的VSI ID替换 22334455 .
Replace 22334455 with your 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挂载.
Make sure to not include swap partition and CD mounts.
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
Replace 11223344 and 22334455 with your identifiers from your Virtual Guest and its block device(s)
参考:
- SoftLayer_Virtual_Guest::createArchiveTransaction
- SoftLayer_Virtual_Guest::getBlockDevices
这篇关于Softlayer-使用此方法需要模板来宾记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!