跳转到主要内容
计算管理/虚拟机相关接口
PUTVM Related Interfaces起始版本 0.6同步需要认证

更新虚拟机信息

更新虚拟机信息

调试可用性

在线调试

使用当前认证信息和示例参数提交 Mock 请求。

路径参数

请求参数

路径参数

  • uuidString必填

    虚拟机UUID

请求体字段

  • updatevminstanceObject必填

    updatevminstance 请求体结构

    • nameString

      虚拟机名

    • descriptionString

      虚拟机详细描述

    • stateString

      虚拟机状态 通常不应该直接更新虚拟机状态,否则会导致虚拟化平台对虚拟机状态发生误判。 该字段只应用于虚拟机真实状态和虚拟化平台记录状态发生不一致,而虚拟化平台同步机制已失效时(通常意味着bug)。 管理员应完全理解使用该字段的后果。

    • defaultL3NetworkUuidString

      默认分布式端口组UUID

    • platformString

      虚拟机平台类型

    • cpuNumInteger

      虚拟机CPU数量。需停止/启动虚拟机后生效 当系统参数NUMA为true情况下创建的虚拟机,支持动态调整

    • memorySizeLong

      虚拟机内存大小。需停止/启动虚拟机后生效 系统参数NUMA为true情况下创建的虚拟机,支持动态调整。

    • guestOsTypeString

      暂无描述。

    • reservedMemorySizeLong

      已预留内存大小。

  • systemTagsList

    系统标签

  • userTagsList

    用户标签

响应状态

200 OK

该 API 成功时返回以下响应结构。

  • successboolean必填

    操作是否成功。

  • errorErrorCode必填

    错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error

    • codeString必填

      错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001

    • descriptionString必填

      错误的概要描述

    • detailsString必填

      错误的详细信息

    • elaborationString必填

      保留字段,默认为null

    • opaqueLinkedHashMap必填

      保留字段,默认为null

    • causeErrorCode必填

      根错误,引发当前错误的源错误,若无原错误,该字段为null

  • inventoryVmInstanceInventory必填

    详情参考inventory

    • uuidString必填

      资源的UUID,唯一标示该资源

    • nameString必填

      资源名称

    • descriptionString必填

      资源的详细描述

    • zoneUuidString必填

      数据中心UUID

    • clusterUuidString必填

      集群UUID

    • imageUuidString必填

      镜像UUID

    • hostUuidString必填

      主机UUID

    • lastHostUuidString必填

      最近一次主机UUID。

    • instanceOfferingUuidString必填

      计算规格UUID

    • rootVolumeUuidString必填

      根硬盘UUID

    • platformString必填

      平台。

    • architectureString必填

      暂无描述。

    • defaultL3NetworkUuidString必填

      暂无描述。

    • typeString必填

      类型。

    • hypervisorTypeString必填

      暂无描述。

    • memorySizeLong必填

      内存大小。

    • cpuNumInteger必填

      暂无描述。

    • cpuSpeedLong必填

      暂无描述。

    • allocatorStrategyString必填

      暂无描述。

    • createDateTimestamp必填

      创建时间

    • lastOpDateTimestamp必填

      最后一次修改时间

    • stateString必填

      当前状态。

    • guestOsTypeString必填

      暂无描述。

    • vmNicsList必填

      详情参考vmNics

      • uuidString必填

        资源的UUID,唯一标示该资源

      • vmInstanceUuidString必填

        虚拟机UUID

      • l3NetworkUuidString必填

        分布式端口组UUID

      • ipString必填

        IP地址

      • macString必填

        MAC地址

      • hypervisorTypeString必填

        虚拟化类型

      • netmaskString必填

        子网掩码

      • gatewayString必填

        网关

      • metaDataString必填

        元数据。

      • ipVersionInteger必填

        IP地址版本

      • driverTypeString必填

        暂无描述。

      • internalNameString必填

        内部名称。

      • deviceIdInteger必填

        设备ID

      • typeString必填

        网卡类型

      • createDateTimestamp必填

        创建时间

      • lastOpDateTimestamp必填

        最后一次修改时间

      • usedIpsList必填

        详情参考usedIps

        • uuidString必填

          资源的UUID,唯一标示该资源

        • ipRangeUuidString必填

          IP段UUID

        • l3NetworkUuidString必填

          分布式端口组UUID

        • ipVersionInteger必填

          IP协议号

        • ipString必填

          IP地址

        • netmaskString必填

          网络掩码

        • gatewayString必填

          网关地址

        • usedForString必填

          已使用用于。

        • ipInLonglong必填

          暂无描述。

        • vmNicUuidString必填

          虚拟机网卡UUID

        • createDateTimestamp必填

          创建时间

        • lastOpDateTimestamp必填

          最后一次修改时间

    • allVolumesList必填

      详情参考allVolumes

      • uuidString必填

        资源的UUID,唯一标示该资源

      • nameString必填

        资源名称

      • descriptionString必填

        资源的详细描述

      • primaryStorageUuidString必填

        数据存储UUID

      • vmInstanceUuidString必填

        虚拟机UUID

      • diskOfferingUuidString必填

        硬盘规格UUID

      • rootImageUuidString必填

        硬盘根镜像UUID

      • installPathString必填

        硬盘在数据存储上的路径

      • typeString必填

        硬盘类型,数据硬盘/根硬盘

      • formatString必填

        硬盘格式

      • sizeLong必填

        硬盘大小

      • actualSizeLong必填

        硬盘真实大小

      • deviceIdInteger必填

        设备ID。

      • stateString必填

        硬盘是否开启

      • statusString必填

        硬盘状态

      • createDateTimestamp必填

        创建时间

      • lastOpDateTimestamp必填

        最后一次修改时间

      • isShareableBoolean必填

        是否可分享。

      • volumeQosString必填

        暂无描述。

      • lastDetachDateTimestamp必填

        最近一次detach时间。

      • lastVmInstanceUuidString必填

        最近一次云主机实例UUID。

    • vmCdRomsList必填

      详情参考vmCdRoms

      • uuidString必填

        资源的UUID,唯一标示该资源

      • vmInstanceUuidString必填

        虚拟机UUID

      • deviceIdInteger必填

        设备ID。

      • isoUuidString必填

        暂无描述。

      • isoInstallPathString必填

        iso安装路径。

      • nameString必填

        资源名称

      • descriptionString必填

        资源的详细描述

      • createDateTimestamp必填

        创建时间

      • lastOpDateTimestamp必填

        最后一次修改时间

请求地址

PUT/zstack/v1/vm-instances/{uuid}/actions

/zstack/v1/vm-instances/{uuid}/actions

操作 ID

UpdateVmInstance

永久链接

请求示例

curl -X PUT 'http://{host}/zstack/v1/vm-instances/{uuid}/actions' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"updatevminstance":{"name":"<name>","description":"<description>","state":"<state>","defaultL3NetworkUuid":"<defaultL3NetworkUuid>","platform":"<platform>","cpuNum":1,"memorySize":1,"guestOsType":"<guestOsType>","reservedMemorySize":1},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

响应示例

200
{ "inventory": { "uuid": "6710cdffb0653455809b6511a6b3aaa4", "name": "new vm name", "description": "web server VM", "zoneUuid": "aa63c5a3b3c436fa94e5e851f057fe23", "clusterUuid": "48b424d94ed239f1b18e1ce37db24cf8", "imageUuid": "4e1ac550da8d30c7b07162acc39773c1", "hostUuid": "1f3ffea4673e3e4197681ee030d1794b", "lastHostUuid": "d334dadb7cfc34da8f6f7d74dfd04692", "instanceOfferingUuid": "33b38aff5cbe3e24a9266300f7163d20", "rootVolumeUuid": "761df8e1eef933ee8d7f3b7f8551b754", "platform": "Linux", "defaultL3NetworkUuid": "3a3c91f4a28a31beb410d6d1c3dc862c", "type": "UserVm", "hypervisorType": "KVM", "memorySize": 8589934592, "cpuNum": 1, "allocatorStrategy": "LastHostPreferredAllocatorStrategy", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM", "state": "Running", "vmNics": [ { "uuid": "ae19167e24713aeea9c45e6f2d27249d", "vmInstanceUuid": "6710cdffb0653455809b6511a6b3aaa4", "usedIpUuid": "010f4817011b32d3b476faa3f393d765", "l3NetworkUuid": "3a3c91f4a28a31beb410d6d1c3dc862c", "ip": "192.168.1.10", "mac": "00:0c:29:bd:99:fc", "hypervisorType": "KVM", "netmask": "255.255.255.0", "gateway": "192.168.1.1", "deviceId": 0, "state": "enable", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ], "allVolumes": [ { "uuid": "761df8e1eef933ee8d7f3b7f8551b754", "name": "Root-Volume-For-VM-6710cdffb0653455809b6511a6b3aaa4", "primaryStorageUuid": "da81ed018a9738ff97a16d7b7a43327d", "vmInstanceUuid": "6710cdffb0653455809b6511a6b3aaa4", "diskOfferingUuid": "bd9b406d36c13fc7ad3f995535415898", "rootImageUuid": "4e1ac550da8d30c7b07162acc39773c1", "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-761df8e1eef933ee8d7f3b7f8551b754/761df8e1eef933ee8d7f3b7f8551b754.qcow2", "type": "Root", "format": "qcow2", "size": 107374182400, "actualSize": 21474836480, "deviceId": 0, "state": "Enabled", "status": "Ready", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ] } }

变更历史

此 API 暂无变更历史记录。

查看全部变更历史