更新虚拟机自定义操作系统规范
Headers
Authorization: OAuth the-session-uuidBody
{
"updateVmCustomSpecification": {
"description": "description"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateVmCustomSpecification":{"description":"description"}}' \
http://localhost:8080/zstack/v1/vm-custom-specifications/ff0a9e874342368bb28daaf2c9b3cc00/actions参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
uuid | String | url | 资源的UUID,唯一标示该资源 |
| 4.10.18 |
name (可选) | String | body(包含在 | 资源名称 |
| 4.10.18 |
description (可选) | String | body(包含在 | 资源的详细描述 |
| 4.10.18 |
hostname (可选) | String | body(包含在 | 主机名称 |
| 4.10.18 |
rootPassword (可选) | String | body(包含在 | 管理员密码 |
| 4.10.18 |
generateSID (可选) | Boolean | body(包含在 | 是否生成SID |
| 4.10.18 |
domainMode (可选) | String | body(包含在 | 加域模式 |
| 4.10.18 |
domainName (可选) | String | body(包含在 | 域名称或工作组名称 |
| 4.10.18 |
domainUsername (可选) | String | body(包含在 | 域用户名 |
| 4.10.18 |
domainPassword (可选) | String | body(包含在 | 域用户密码 |
| 4.10.18 |
organization (可选) | String | body(包含在 | 组织单位 |
| 4.10.18 |
systemTags (可选) | List | body | 系统标签 |
| 4.10.18 |
userTags (可选) | List | body | 用户标签 |
| 4.10.18 |
API返回
返回示例
{
"inventory": {
"uuid": "ff0a9e874342368bb28daaf2c9b3cc00",
"vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
"name": "custom-specification-for-vm-1",
"description": "Test",
"platform": "Windows",
"hostname": "vm-1",
"rootPassword": "password",
"generateSID": true,
"domainMode": "Domain",
"domainName": "zsv.test",
"domainUsername": "test",
"domainPassword": "password",
"organization": "OU=zsv,DC=zsv,DC=test"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.10.18 | |
| inventory | VmCustomSpecificationInventory | 详情参考inventory | 4.10.18 |
| error | ErrorCode | 详情参考error | 4.10.18 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.10.18 |
| vmInstanceUuid | String | 虚拟机UUID | 4.10.18 |
| name | String | 资源名称 | 4.10.18 |
| description | String | 资源的详细描述 | 4.10.18 |
| platform | String | 虚拟机操作系统平台类型 | 4.10.18 |
| hostname | String | 主机名称 | 4.10.18 |
| generateSID | Boolean | 是否生成SID | 4.10.18 |
| domainName | String | 域名称或工作组名称 | 4.10.18 |
| domainUsername | String | 域用户名 | 4.10.18 |
| organization | String | 组织单位 | 4.10.18 |
| createDate | Timestamp | 创建时间 | 4.10.18 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.10.18 |
| domainMode | VmCustomSpecificationDomainMode | 详情参考domainMode | 4.10.18 |
domainMode
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| WorkGroup | VmCustomSpecificationDomainMode | 工作组 | 4.10.18 |
| Domain | VmCustomSpecificationDomainMode | 域 | 4.10.18 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
SDK示例
Java SDK
UpdateVmCustomSpecificationAction action = new UpdateVmCustomSpecificationAction();
action.uuid = "ff0a9e874342368bb28daaf2c9b3cc00";
action.description = "description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVmCustomSpecificationAction.Result res = action.call();Python SDK
action = UpdateVmCustomSpecificationAction()
action.uuid = "ff0a9e874342368bb28daaf2c9b3cc00"
action.description = "description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()