为云主机加载增强工具镜像(AttachGuestToolsIsoToVm)
API请求
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"attachGuestToolsIsoToVm": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"attachGuestToolsIsoToVm":{}}' http://localhost:8080/zstack/v1/vm-instances/f58d939e32073aa49acc4897bf81ae45/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 3.7.0 | |
| systemTags (可选) | List | body | 系统标签 | 3.7.0 | |
| userTags (可选) | List | body | 用户标签 | 3.7.0 |
Note:
- ZStack云主机加载增强工具后支持记录GuestTools版本功能,SystemTags增加GuestTools选项。
- 选项格式为:
GuestTools::TOOLS_VERSION。其中TOOLS_VERSION初值为1.0.0,未来随着工具版本的提升,这个值会随之变化。 - 例如:
GuestTools::1.0.0 - 意义:记录物理机中GuestTools ISO版本,与管理节点/opt/zstack-dvd目录下的ISO版本对比,决定是否需要升级。
- 选项格式为:
API返回
该API成功时返回一个空的JSON结构
{},出错时返回的JSON结构包含一个error字段,例如:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
AttachGuestToolsIsoToVmAction action = new AttachGuestToolsIsoToVmAction();
action.uuid = "f58d939e32073aa49acc4897bf81ae45";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachGuestToolsIsoToVmAction.Result res = action.call();Python
SDK
AttachGuestToolsIsoToVmAction action = AttachGuestToolsIsoToVmAction()
action.uuid = "f58d939e32073aa49acc4897bf81ae45"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachGuestToolsIsoToVmAction.Result res = action.call()