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

克隆虚拟机

克隆虚拟机

调试可用性

在线调试

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

路径参数

请求参数

路径参数

  • vmInstanceUuidString必填

    虚拟机UUID

请求体字段

  • strategyString

    处理策略。

  • namesList必填

    云主机实例名称列表。

  • fullBoolean

    克隆mounted数据volumes。

  • systemTagsList

    系统标签

  • userTagsList

    用户标签

响应状态

200 OK

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

  • successboolean必填

    操作是否成功。

  • errorErrorCode必填

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

    • codeString必填

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

    • descriptionString必填

      错误的概要描述

    • detailsString必填

      错误的详细信息

    • elaborationString必填

      保留字段,默认为null

    • opaqueLinkedHashMap必填

      保留字段,默认为null

    • causeErrorCode必填

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

  • resultCloneVmInstanceResults必填

    详情参考result

    • numberOfClonedVmint必填

      暂无描述。

    • inventoriesList必填

      详情参考inventories

      • errorErrorCode必填

        详情参考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必填

            暂无描述。

          • hypervisorTypeString必填

            暂无描述。

          • netmaskString必填

            暂无描述。

          • gatewayString必填

            暂无描述。

          • metaDataString必填

            元数据。

          • ipVersionInteger必填

            IP版本。

          • driverTypeString必填

            暂无描述。

          • internalNameString必填

            内部名称。

          • deviceIdInteger必填

            设备ID。

          • typeString必填

            类型。

          • stateString必填

            网卡状态

          • createDateTimestamp必填

            创建时间

          • lastOpDateTimestamp必填

            最后一次修改时间

          • usedIpsList必填

            详情参考usedIps

            • uuidString必填

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

            • ipRangeUuidString必填

              IP段UUID

            • l3NetworkUuidString必填

              分布式端口组UUID

            • ipVersionInteger必填

              IP协议号

            • ipString必填

              IP地址

            • netmaskString必填

              子网掩码

            • gatewayString必填

              网关地址

            • usedForString必填

              分配原因

            • ipInLonglong必填

              Long存储的IP地址,仅ipv4有效

            • ipInBinarybyte[]必填

              二进制存储的IP地址(字节数组,IPv4长度4,IPv6长度16,网络序)

            • 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/{vmInstanceUuid}/actions

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

操作 ID

CloneVmInstance

永久链接

请求示例

curl -X PUT 'http://{host}/zstack/v1/vm-instances/{vmInstanceUuid}/actions' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"strategy":"<strategy>","names":["<names>"],"full":true,"systemTags":["<systemTags>"],"userTags":["<userTags>"],"primaryStorageUuidForRootVolume":"<primaryStorageUuidForRootVolume>","primaryStorageUuidForDataVolume":"<primaryStorageUuidForDataVolume>","rootVolumeSystemTags":["<rootVolumeSystemTags>"],"dataVolumeSystemTags":["<dataVolumeSystemTags>"],"clusterUuid":"<clusterUuid>","hostUuid":"<hostUuid>","diskAOs":["<diskAOs>"],"description":"<description>","vmNicParams":"<vmNicParams>","vmCustomSpecification":"<vmCustomSpecification>","resetTpm":true}'

响应示例

200
{ "result": { "numberOfClonedVm": 1, "inventories": [ { "inventory": { "uuid": "327b60d6b8cd31489ade6f4830bcec16", "name": "new vm name", "description": "web server VM", "zoneUuid": "d886a09330e13282b7a320a98d0a53ec", "clusterUuid": "f6f07dff7ede3b8cac7c8595a1698832", "imageUuid": "3b7ff22eb60d38318835817ba6a2b6a2", "hostUuid": "70c0f5223d083dfea2f1a02f69906306", "lastHostUuid": "123f7f85f82f3e99940836d97ae18e04", "instanceOfferingUuid": "001537d10c433857a7a98ae0a362c910", "rootVolumeUuid": "c8be7ec6a8573d98a580b457a7245141", "platform": "Linux", "defaultL3NetworkUuid": "2ac50b85591b3e87b2686c529cf062f9", "type": "UserVm", "hypervisorType": "KVM", "memorySize": 8589934592, "cpuNum": 1, "allocatorStrategy": "LastHostPreferredAllocatorStrategy", "createDate": "Nov 14, 2017 2:20:57 PM", "lastOpDate": "Nov 14, 2017 2:20:57 PM", "state": "Running", "allVolumes": [ { "uuid": "c8be7ec6a8573d98a580b457a7245141", "name": "Root-Volume-For-VM-327b60d6b8cd31489ade6f4830bcec16", "primaryStorageUuid": "c2a27c5268493a5cba84b94e37b86b4d", "vmInstanceUuid": "327b60d6b8cd31489ade6f4830bcec16", "diskOfferingUuid": "358e00e7245a39b9aa1c1849d6ba9701", "rootImageUuid": "3b7ff22eb60d38318835817ba6a2b6a2", "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-c8be7ec6a8573d98a580b457a7245141/c8be7ec6a8573d98a580b457a7245141.qcow2", "type": "Root", "format": "qcow2", "size": 107374182400, "actualSize": 21474836480, "deviceId": 0, "state": "Enabled", "status": "Ready", "createDate": "Nov 14, 2017 2:20:57 PM", "lastOpDate": "Nov 14, 2017 2:20:57 PM" } ] } } ] } }

变更历史

此 API 暂无变更历史记录。

查看全部变更历史