创建一个新的虚拟机。
POST zstack/v1/vm-instances
Authorization: OAuth the-session-uuid
{ "params": { "name": "vm1", "instanceOfferingUuid": "ae97ced44efc3314b8f7798972b4ba1a", "imageUuid": "da119f7906513eccabf271991c35a65e", "l3NetworkUuids": [ "cc0e4c5e77df3af68e59668e7f9e06c5" ], "dataDiskOfferingUuids": [ "19d22d051b063d379a2816daaf431838", "905d94a6abb5398fa1995f6398e3f6fc" ], "clusterUuid": "a0468dc645223f67bd0f2ab95276bbae", "description": "this is a vm", "strategy": "InstantStart", "rootVolumeSystemTags": [ "volumeProvisioningStrategy::ThickProvisioning" ] }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"name":"vm1","instanceOfferingUuid":"ae97ced44efc3314b8f7798972b4ba1a","imageUuid":"da119f7906513eccabf271991c35a65e","l3NetworkUuids":["cc0e4c5e77df3af68e59668e7f9e06c5"],"dataDiskOfferingUuids":["19d22d051b063d379a2816daaf431838","905d94a6abb5398fa1995f6398e3f6fc"],"clusterUuid":"a0468dc645223f67bd0f2ab95276bbae","description":"this is a vm","strategy":"InstantStart","rootVolumeSystemTags":["volumeProvisioningStrategy::ThickProvisioning"]}}' http://localhost:8080/zstack/v1/vm-instances
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
---|---|---|---|---|---|
name | String | body(包含在params结构中) | 虚拟机名称 | 0.6 | |
instanceOfferingUuid (可选) | String | body(包含在params结构中) | 计算规格UUID
| 0.6 | |
imageUuid (可选) | String | body(包含在params结构中) | 镜像UUID
| 0.6 | |
l3NetworkUuids (可选) | List | body(包含在params结构中) | 分布式端口组UUID列表
| 0.6 | |
vmNicParams (可选) | String | body(包含在params结构中) | 网卡信息 | 4.7.0 | |
type (可选) | String | body(包含在params结构中) | 虚拟机类型
|
| 0.6 |
rootDiskOfferingUuid (可选) | String | body(包含在params结构中) | 根硬盘规格UUID
| 0.6 | |
dataDiskSizes (可选) | List | body(包含在params结构中) | 自定义硬盘大小列表。可以指定一个或多个硬盘大小(可重复)为虚拟机创建一个或多个数据硬盘。 | 4.4.6 | |
dataDiskOfferingUuids (可选) | List | body(包含在params结构中) | 硬盘规格UUID列表
| 0.6 | |
zoneUuid (可选) | String | body(包含在params结构中) | 数据中心UUID
| 0.6 | |
clusterUuid (可选) | String | body(包含在params结构中) | 集群UUID
| 0.6 | |
hostUuid (可选) | String | body(包含在params结构中) | 主机UUID
| 0.6 | |
primaryStorageUuidForRootVolume (可选) | String | body(包含在params结构中) | 数据存储UUID
| 1.8 | |
description (可选) | String | body(包含在params结构中) | 虚拟机的详细描述 | 0.6 | |
defaultL3NetworkUuid (可选) | String | body(包含在params结构中) | 默认分布式端口组UUID
| 0.6 | |
resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID
| 0.6 | |
tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.4.0 | |
systemTags (可选) | List | body | 虚拟机系统标签 | 0.6 | |
userTags (可选) | List | body | 虚拟机用户标签 | 0.6 | |
strategy (可选) | String | body(包含在params结构中) | 虚拟机创建策略
|
| 0.6 |
rootVolumeSystemTags (可选) | List | body(包含在params结构中) | 虚拟机根盘所需要的系统标签 | 3.0 | |
dataVolumeSystemTags (可选) | List | body(包含在params结构中) | 虚拟机数据盘所需要的系统标签 | 3.0 | |
cpuNum (可选) | Integer | body(包含在params结构中) | 3.4.0 | ||
memorySize (可选) | Long | body(包含在params结构中) | 3.4.0 | ||
rootDiskSize (可选) | Long | body(包含在params结构中) | 3.4.0 | ||
dataVolumeSystemTagsOnIndex (可选) | Map | body(包含在params结构中) | 4.4.24 | ||
sshKeyPairUuids (可选) | List | body(包含在params结构中) | 4.7.21 | ||
dataVolumeTemplateUuids (可选) | List | body(包含在params结构中) | 4.7.0 | ||
diskAOs (可选) | List | body(包含在params结构中) | boot=true表示diskAO用于设置虚拟机平台、架构、操作系统与根盘总线;diskAO.boot=false表示加载的硬盘 | 4.7.0 | |
platform (可选) | String | body(包含在params结构中) | 4.7.0 | ||
guestOsType (可选) | String | body(包含在params结构中) | 4.7.0 | ||
architecture (可选) | String | body(包含在params结构中) | 4.7.21 | ||
reservedMemorySize (可选) | Long | body(包含在params结构中) | 4.7.21 | ||
virtio (可选) | Boolean | body(包含在params结构中) | 4.7.0 |
{ "inventory": { "uuid": "6efab7159c6932429c6b0e7e0b64b660", "name": "Test-VM", "description": "web server VM", "zoneUuid": "d10bd7a9565138efaf6171db8e18fa7d", "clusterUuid": "692c71639d873bf6a356cd8e285d0d9c", "imageUuid": "28061e65e48037eda71b53a0732bf087", "hostUuid": "f877177de7bd377e811bc6313878b2b1", "lastHostUuid": "a3ccdc90a600334f994c69aee4270ac5", "instanceOfferingUuid": "9a874241f867333ca0bf0ab2134f8515", "rootVolumeUuid": "f52d7c94d69d3bbb97d36a270fe910c3", "platform": "Linux", "defaultL3NetworkUuid": "2ac1b70fdb0f38769a29c6ebd0262cca", "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": "0dfbb8a297e9349ea8799c4ce48c6d10", "vmInstanceUuid": "6efab7159c6932429c6b0e7e0b64b660", "usedIpUuid": "39b57596a8ba35289bd9f40efceeae03", "l3NetworkUuid": "2ac1b70fdb0f38769a29c6ebd0262cca", "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": "f52d7c94d69d3bbb97d36a270fe910c3", "name": "Root-Volume-For-VM-6efab7159c6932429c6b0e7e0b64b660", "primaryStorageUuid": "4ed5bbb150a034b5917e7e6c9c4b8170", "vmInstanceUuid": "6efab7159c6932429c6b0e7e0b64b660", "diskOfferingUuid": "0521187274d73f5b936c22b145384c74", "rootImageUuid": "28061e65e48037eda71b53a0732bf087", "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f52d7c94d69d3bbb97d36a270fe910c3/f52d7c94d69d3bbb97d36a270fe910c3.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" } ] } }
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
success | boolean | 0.6 | |
error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
inventory | VmInstanceInventory | 详情参考inventory | 0.6 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
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 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
name | String | 资源名称 | 0.6 |
description | String | 资源的详细描述 | 0.6 |
zoneUuid | String | 数据中心UUID | 0.6 |
clusterUuid | String | 集群UUID | 0.6 |
imageUuid | String | 镜像UUID | 0.6 |
hostUuid | String | 主机UUID | 0.6 |
lastHostUuid | String | 上一次运行虚拟机的主机UUID | 0.6 |
instanceOfferingUuid | String | 计算规格UUID | 0.6 |
rootVolumeUuid | String | 根硬盘UUID | 0.6 |
platform | String | 虚拟机运行平台 | 0.6 |
architecture | String | 0.6 | |
defaultL3NetworkUuid | String | 默认分布式端口组UUID | 0.6 |
type | String | 虚拟机类型 | 0.6 |
hypervisorType | String | 虚拟机的hypervisor类型 | 0.6 |
memorySize | Long | 内存大小 | 0.6 |
cpuNum | Integer | cpu数量 | 0.6 |
cpuSpeed | Long | cpu主频 | 0.6 |
allocatorStrategy | String | 分配策略 | 0.6 |
createDate | Timestamp | 创建时间 | 0.6 |
lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
state | String | 虚拟机的可用状态 | 0.6 |
guestOsType | String | 4.1.2 | |
vmNics | List | 详情参考vmNics | 0.6 |
allVolumes | List | 详情参考allVolumes | 0.6 |
vmCdRoms | List | 详情参考vmCdRoms | 0.6 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
vmInstanceUuid | String | 虚拟机UUID | 4.7.13 |
l3NetworkUuid | String | 分布式端口组UUID | 4.7.13 |
ip | String | 4.7.13 | |
mac | String | 4.7.13 | |
hypervisorType | String | 4.7.13 | |
netmask | String | 4.7.13 | |
gateway | String | 4.7.13 | |
metaData | String | 4.7.13 | |
ipVersion | Integer | 4.7.13 | |
driverType | String | 4.7.13 | |
internalName | String | 4.7.13 | |
deviceId | Integer | 4.7.13 | |
type | String | 4.7.13 | |
state | String | 网卡状态 | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
usedIps | List | 详情参考usedIps | 4.7.13 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
ipRangeUuid | String | IP段UUID | 4.7.13 |
l3NetworkUuid | String | 分布式端口组UUID | 4.7.13 |
ipVersion | Integer | 4.7.13 | |
ip | String | 4.7.13 | |
netmask | String | 4.7.13 | |
gateway | String | 4.7.13 | |
usedFor | String | 4.7.13 | |
ipInLong | long | 4.7.13 | |
vmNicUuid | String | 虚拟机网卡UUID | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
name | String | 资源名称 | 4.7.13 |
description | String | 资源的详细描述 | 4.7.13 |
primaryStorageUuid | String | 数据存储UUID | 4.7.13 |
vmInstanceUuid | String | 虚拟机UUID | 4.7.13 |
diskOfferingUuid | String | 硬盘规格UUID | 4.7.13 |
rootImageUuid | String | 4.7.13 | |
installPath | String | 4.7.13 | |
type | String | 4.7.13 | |
format | String | 4.7.13 | |
size | Long | 4.7.13 | |
actualSize | Long | 4.7.13 | |
deviceId | Integer | 4.7.13 | |
state | String | 4.7.13 | |
status | String | 4.7.13 | |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
isShareable | Boolean | 4.7.13 | |
volumeQos | String | 4.7.13 | |
lastDetachDate | Timestamp | 4.7.13 | |
lastVmInstanceUuid | String | 4.7.13 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
vmInstanceUuid | String | 虚拟机UUID | 4.7.13 |
deviceId | Integer | 4.7.13 | |
isoUuid | String | 4.7.13 | |
isoInstallPath | String | 4.7.13 | |
name | String | 资源名称 | 4.7.13 |
description | String | 资源的详细描述 | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
CreateVmInstanceAction action = new CreateVmInstanceAction(); action.name = "vm1"; action.instanceOfferingUuid = "ae97ced44efc3314b8f7798972b4ba1a"; action.imageUuid = "da119f7906513eccabf271991c35a65e"; action.l3NetworkUuids = asList("cc0e4c5e77df3af68e59668e7f9e06c5"); action.dataDiskOfferingUuids = asList("19d22d051b063d379a2816daaf431838","905d94a6abb5398fa1995f6398e3f6fc"); action.clusterUuid = "a0468dc645223f67bd0f2ab95276bbae"; action.description = "this is a vm"; action.strategy = "InstantStart"; action.rootVolumeSystemTags = asList("volumeProvisioningStrategy::ThickProvisioning"); action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; CreateVmInstanceAction.Result res = action.call();
CreateVmInstanceAction action = CreateVmInstanceAction() action.name = "vm1" action.instanceOfferingUuid = "ae97ced44efc3314b8f7798972b4ba1a" action.imageUuid = "da119f7906513eccabf271991c35a65e" action.l3NetworkUuids = [cc0e4c5e77df3af68e59668e7f9e06c5] action.dataDiskOfferingUuids = [19d22d051b063d379a2816daaf431838, 905d94a6abb5398fa1995f6398e3f6fc] action.clusterUuid = "a0468dc645223f67bd0f2ab95276bbae" action.description = "this is a vm" action.strategy = "InstantStart" action.rootVolumeSystemTags = [volumeProvisioningStrategy::ThickProvisioning] action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" CreateVmInstanceAction.Result res = action.call()
POST zstack/v1/vm-instances/from/volume
Authorization: OAuth the-session-uuid
{ "params": { "name": "vm1", "description": "this is a vm", "instanceOfferingUuid": "80c606e35bc038bbb102e31cae191ea2", "l3NetworkUuids": [ "333817afcaf63f13a101f674761c8a77" ], "volumeUuid": "23984cd68b903fd4883aa962c70d83fc", "clusterUuid": "ada53eb6c42e34d3946ff1280718d9f2", "strategy": "InstantStart" }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"vm1","description":"this is a vm","instanceOfferingUuid":"80c606e35bc038bbb102e31cae191ea2","l3NetworkUuids":["333817afcaf63f13a101f674761c8a77"],"volumeUuid":"23984cd68b903fd4883aa962c70d83fc","clusterUuid":"ada53eb6c42e34d3946ff1280718d9f2","strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/vm-instances/from/volume
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
---|---|---|---|---|---|
name | String | body(包含在params结构中) | 资源名称 | 3.10.0 | |
description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 3.10.0 | |
instanceOfferingUuid (可选) | String | body(包含在params结构中) | 计算规格UUID,注意:该参数与CPU数量、内存大小二选一 | 3.10.0 | |
cpuNum (可选) | Integer | body(包含在params结构中) | CPU核数,单位为GB,该参数与instanceOfferingUuid二选一 | 3.10.0 | |
memorySize (可选) | Long | body(包含在params结构中) | 内存大小,单位为Byte,该参数与instanceOfferingUuid二选一 | 3.10.0 | |
l3NetworkUuids (可选) | List | body(包含在params结构中) | 分布式端口组UUID
| 3.10.0 | |
vmNicParams (可选) | String | body(包含在params结构中) | 网卡信息 | 4.0.0 | |
type (可选) | String | body(包含在params结构中) | 虚拟机类型
|
| 3.10.0 |
volumeUuid | String | body(包含在params结构中) | 硬盘UUID | 4.1.0 | |
platform (可选) | String | body(包含在params结构中) | 硬盘系统平台 |
| 3.10.0 |
zoneUuid (可选) | String | body(包含在params结构中) | 数据中心UUID
| 3.10.0 | |
clusterUuid (可选) | String | body(包含在params结构中) | 集群UUID
| 3.10.0 | |
hostUuid (可选) | String | body(包含在params结构中) | 主机UUID
| 3.10.0 | |
primaryStorageUuid (可选) | String | body(包含在params结构中) | 数据存储UUID
| 3.10.0 | |
defaultL3NetworkUuid (可选) | String | body(包含在params结构中) | 默认分布式端口组UUID
| 3.10.0 | |
strategy (可选) | String | body(包含在params结构中) | 虚拟机创建策略
|
| 3.10.0 |
resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID
| 3.10.0 | |
tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 3.10.0 | |
systemTags (可选) | List | body | 虚拟机系统标签 | 3.10.0 | |
userTags (可选) | List | body | 虚拟机用户标签 | 3.10.0 | |
reservedMemorySize (可选) | Long | body(包含在params结构中) | 4.7.21 |
{ "inventory": { "uuid": "33614668ae7d386c91d662928f60b23f", "name": "Test-VM", "description": "web server VM", "zoneUuid": "62f048b02e353ba4bdb9184ad7f54170", "clusterUuid": "ff753adc06c83d5ab2b0291f57b4745a", "imageUuid": "9291412f184f37a284b484b0788b24ca", "hostUuid": "0f9f5c6561d733d18a94577c4cd0976f", "lastHostUuid": "dc452dde2f7832b29bf91a0ddb6a004c", "instanceOfferingUuid": "b35adab33ba139b98ee20c1e2be702d3", "rootVolumeUuid": "f54fc6d488133688a6a7635f5c44a288", "platform": "Linux", "defaultL3NetworkUuid": "d82e3c622f933054a1939fb66e07681e", "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": "16198ebdef9c3f8084acd1a919eff4f2", "vmInstanceUuid": "33614668ae7d386c91d662928f60b23f", "usedIpUuid": "8eb3618f949a3e588acf9d8b0ee8293f", "l3NetworkUuid": "d82e3c622f933054a1939fb66e07681e", "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": "f54fc6d488133688a6a7635f5c44a288", "name": "Root-Volume-For-VM-33614668ae7d386c91d662928f60b23f", "primaryStorageUuid": "769061e63aec3278b1e6c3619d6da766", "vmInstanceUuid": "33614668ae7d386c91d662928f60b23f", "rootImageUuid": "9291412f184f37a284b484b0788b24ca", "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f54fc6d488133688a6a7635f5c44a288/f54fc6d488133688a6a7635f5c44a288.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" } ] } }
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
success | boolean | 0.6 | |
error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.10.0 |
inventory | VmInstanceInventory | 详情参考inventory | 3.10.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.10.0 |
description | String | 错误的概要描述 | 3.10.0 |
details | String | 错误的详细信息 | 3.10.0 |
elaboration | String | 保留字段,默认为null | 3.10.0 |
opaque | LinkedHashMap | 保留字段,默认为null | 3.10.0 |
cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.10.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 3.10.0 |
name | String | 资源名称 | 3.10.0 |
description | String | 资源的详细描述 | 3.10.0 |
zoneUuid | String | 数据中心UUID | 3.10.0 |
clusterUuid | String | 集群UUID | 3.10.0 |
imageUuid | String | 镜像UUID | 3.10.0 |
hostUuid | String | 主机UUID | 3.10.0 |
lastHostUuid | String | 3.10.0 | |
instanceOfferingUuid | String | 计算规格UUID | 3.10.0 |
rootVolumeUuid | String | 根硬盘UUID | 3.10.0 |
platform | String | 3.10.0 | |
architecture | String | 0.6 | |
defaultL3NetworkUuid | String | 3.10.0 | |
type | String | 3.10.0 | |
hypervisorType | String | 3.10.0 | |
memorySize | Long | 3.10.0 | |
cpuNum | Integer | 3.10.0 | |
cpuSpeed | Long | 3.10.0 | |
allocatorStrategy | String | 3.10.0 | |
createDate | Timestamp | 创建时间 | 3.10.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 3.10.0 |
state | String | 3.10.0 | |
guestOsType | String | 4.1.2 | |
vmNics | List | 详情参考vmNics | 3.10.0 |
allVolumes | List | 详情参考allVolumes | 3.10.0 |
vmCdRoms | List | 详情参考vmCdRoms | 0.6 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 3.10.0 |
vmInstanceUuid | String | 虚拟机UUID | 3.10.0 |
l3NetworkUuid | String | 分布式端口组UUID | 3.10.0 |
ip | String | ip地址 | 3.10.0 |
mac | String | mac地址 | 3.10.0 |
hypervisorType | String | 虚拟化类型 | 3.10.0 |
netmask | String | 子网掩码 | 3.10.0 |
gateway | String | 网关 | 3.10.0 |
metaData | String | 内部使用的保留域 | 3.10.0 |
ipVersion | Integer | IP地址版本 | 3.10.0 |
driverType | String | 4.7.13 | |
internalName | String | 4.7.13 | |
deviceId | Integer | 设备ID | 3.10.0 |
type | String | 4.7.13 | |
state | String | 网卡状态 | 4.7.13 |
createDate | Timestamp | 创建时间 | 3.10.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 3.10.0 |
usedIps | List | 详情参考usedIps | 3.10.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 3.10.0 |
ipRangeUuid | String | IP段UUID | 3.10.0 |
l3NetworkUuid | String | 分布式端口组UUID | 3.10.0 |
ipVersion | Integer | IP协议号 | 3.10.0 |
ip | String | IP地址 | 3.10.0 |
netmask | String | 网络掩码 | 3.10.0 |
gateway | String | 网关地址 | 3.10.0 |
usedFor | String | 3.10.0 | |
ipInLong | long | 3.10.0 | |
vmNicUuid | String | 虚拟机网卡UUID | 3.10.0 |
createDate | Timestamp | 创建时间 | 3.10.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 3.10.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 3.10.0 |
name | String | 资源名称 | 3.10.0 |
description | String | 资源的详细描述 | 3.10.0 |
primaryStorageUuid | String | 数据存储UUID | 3.10.0 |
vmInstanceUuid | String | 虚拟机UUID | 3.10.0 |
diskOfferingUuid | String | 硬盘规格UUID | 3.10.0 |
rootImageUuid | String | 硬盘根镜像UUID | 3.10.0 |
installPath | String | 硬盘在数据存储上的路径 | 3.10.0 |
type | String | 硬盘类型,数据硬盘/根硬盘 | 3.10.0 |
format | String | 硬盘格式 | 3.10.0 |
size | Long | 硬盘大小 | 3.10.0 |
actualSize | Long | 硬盘真实大小 | 3.10.0 |
deviceId | Integer | 3.10.0 | |
state | String | 硬盘是否开启 | 3.10.0 |
status | String | 硬盘状态 | 3.10.0 |
createDate | Timestamp | 创建时间 | 3.10.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 3.10.0 |
isShareable | Boolean | 是否共享硬盘 | 3.10.0 |
volumeQos | String | 3.10.0 | |
lastDetachDate | Timestamp | 4.7.13 | |
lastVmInstanceUuid | String | 4.7.13 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
vmInstanceUuid | String | 虚拟机UUID | 4.7.13 |
deviceId | Integer | 4.7.13 | |
isoUuid | String | 4.7.13 | |
isoInstallPath | String | 4.7.13 | |
name | String | 资源名称 | 4.7.13 |
description | String | 资源的详细描述 | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
CreateVmInstanceFromVolumeAction action = new CreateVmInstanceFromVolumeAction(); action.name = "vm1"; action.description = "this is a vm"; action.instanceOfferingUuid = "80c606e35bc038bbb102e31cae191ea2"; action.l3NetworkUuids = asList("333817afcaf63f13a101f674761c8a77"); action.volumeUuid = "23984cd68b903fd4883aa962c70d83fc"; action.clusterUuid = "ada53eb6c42e34d3946ff1280718d9f2"; action.strategy = "InstantStart"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; CreateVmInstanceFromVolumeAction.Result res = action.call();
CreateVmInstanceFromVolumeAction action = CreateVmInstanceFromVolumeAction() action.name = "vm1" action.description = "this is a vm" action.instanceOfferingUuid = "80c606e35bc038bbb102e31cae191ea2" action.l3NetworkUuids = [333817afcaf63f13a101f674761c8a77] action.volumeUuid = "23984cd68b903fd4883aa962c70d83fc" action.clusterUuid = "ada53eb6c42e34d3946ff1280718d9f2" action.strategy = "InstantStart" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" CreateVmInstanceFromVolumeAction.Result res = action.call()
POST zstack/v1/vm-instances/from/volume-snapshots/{volumeSnapshotUuid}
Authorization: OAuth the-session-uuid
{ "params": { "name": "vm1", "description": "this is a vm", "instanceOfferingUuid": "6900e329296732aca0e3658bcdcdd3ce", "l3NetworkUuids": [ "990ffab4793036d29fc92142889f9ef2" ], "clusterUuid": "cd44bab6f1d43e59bbc885f869e89388", "strategy": "InstantStart" }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"vm1","description":"this is a vm","instanceOfferingUuid":"6900e329296732aca0e3658bcdcdd3ce","l3NetworkUuids":["990ffab4793036d29fc92142889f9ef2"],"clusterUuid":"cd44bab6f1d43e59bbc885f869e89388","strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/vm-instances/from/volume-snapshots/f81c959344783f19ae4fc76f1e770201
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
---|---|---|---|---|---|
name | String | body(包含在params结构中) | 资源名称 | 4.1.0 | |
description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.1.0 | |
instanceOfferingUuid (可选) | String | body(包含在params结构中) | 计算规格UUID | 4.1.0 | |
cpuNum (可选) | Integer | body(包含在params结构中) | CPU数量 | 4.1.0 | |
memorySize (可选) | Long | body(包含在params结构中) | 内存大小 | 4.1.0 | |
l3NetworkUuids | List | body(包含在params结构中) | 分布式端口组UUID | 4.1.0 | |
type (可选) | String | body(包含在params结构中) | 虚拟机系统平台类型 |
| 4.1.0 |
vmNicParams (可选) | String | body(包含在params结构中) | 网卡信息 | 4.0.0 | |
volumeSnapshotUuid | String | url | 快照组UUID | 4.1.0 | |
platform (可选) | String | body(包含在params结构中) | 虚拟机系统平台类型 |
| 4.1.0 |
zoneUuid (可选) | String | body(包含在params结构中) | 数据中心UUID | 4.1.0 | |
clusterUuid (可选) | String | body(包含在params结构中) | 集群UUID | 4.1.0 | |
hostUuid (可选) | String | body(包含在params结构中) | 主机UUID | 4.1.0 | |
primaryStorageUuid (可选) | String | body(包含在params结构中) | 数据存储UUID | 4.1.0 | |
defaultL3NetworkUuid (可选) | String | body(包含在params结构中) | 默认分布式端口组UUID | 4.1.0 | |
strategy (可选) | String | body(包含在params结构中) | 创建策略 |
| 4.1.0 |
resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.1.0 | |
tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.1.0 | |
systemTags (可选) | List | body | 系统标签 | 4.1.0 | |
userTags (可选) | List | body | 用户标签 | 4.1.0 | |
rootVolumeSystemTags (可选) | List | body(包含在params 结构中) | 根硬盘的系统标签 | 4.1.0 | |
reservedMemorySize (可选) | Long | body(包含在params 结构中) | 4.7.21 |
{ "inventory": { "uuid": "56331ef0c0713bc09dc2dc160fd4d48a", "name": "Test-VM", "description": "web server VM", "zoneUuid": "49783ceb7da734aab1ea137f2b7b82ac", "clusterUuid": "ebfbd2a6e08a3b78b70c9b6093f40d37", "imageUuid": "9a4914937dcd3149810793f8b040e8ad", "hostUuid": "2665407c38f932c08f3fb33bb6c8f3f4", "lastHostUuid": "2a847b5699b535d7a78b57cd411ffeac", "instanceOfferingUuid": "041ff292e60f31079dd8e6e3c9c26c72", "rootVolumeUuid": "98648a22b2c639ee88571bf1c429caba", "platform": "Linux", "defaultL3NetworkUuid": "4f80edbb396b346c9af4dcce48f94fb5", "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": "1e1b705f391c3f40a2b6ae447d0e12ca", "vmInstanceUuid": "56331ef0c0713bc09dc2dc160fd4d48a", "usedIpUuid": "bf85263c007d3959a166599181daa4b7", "l3NetworkUuid": "4f80edbb396b346c9af4dcce48f94fb5", "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": "98648a22b2c639ee88571bf1c429caba", "name": "Root-Volume-For-VM-56331ef0c0713bc09dc2dc160fd4d48a", "primaryStorageUuid": "406362409f493e14952262df535e9cf8", "vmInstanceUuid": "56331ef0c0713bc09dc2dc160fd4d48a", "rootImageUuid": "9a4914937dcd3149810793f8b040e8ad", "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-98648a22b2c639ee88571bf1c429caba/98648a22b2c639ee88571bf1c429caba.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" } ] } }
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
success | boolean | 0.6 | |
error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.1.0 |
inventory | VmInstanceInventory | 详情参考inventory | 4.1.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.1.0 |
description | String | 错误的概要描述 | 4.1.0 |
details | String | 错误的详细信息 | 4.1.0 |
elaboration | String | 保留字段,默认为null | 4.1.0 |
opaque | LinkedHashMap | 保留字段,默认为null | 4.1.0 |
cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.1.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.1.0 |
name | String | 资源名称 | 4.1.0 |
description | String | 资源的详细描述 | 4.1.0 |
zoneUuid | String | 数据中心UUID | 4.1.0 |
clusterUuid | String | 集群UUID | 4.1.0 |
imageUuid | String | 镜像UUID | 4.1.0 |
hostUuid | String | 主机UUID | 4.1.0 |
lastHostUuid | String | 4.1.0 | |
instanceOfferingUuid | String | 计算规格UUID | 4.1.0 |
rootVolumeUuid | String | 根硬盘UUID | 4.1.0 |
platform | String | 4.1.0 | |
defaultL3NetworkUuid | String | 4.1.0 | |
type | String | 4.1.0 | |
hypervisorType | String | 4.1.0 | |
memorySize | Long | 4.1.0 | |
cpuNum | Integer | 4.1.0 | |
cpuSpeed | Long | 4.1.0 | |
allocatorStrategy | String | 4.1.0 | |
createDate | Timestamp | 创建时间 | 4.1.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.1.0 |
state | String | 4.1.0 | |
guestOsType | String | 4.1.2 | |
vmNics | List | 详情参考vmNics | 4.1.0 |
allVolumes | List | 详情参考allVolumes | 4.1.0 |
vmCdRoms | List | 详情参考vmCdRoms | 0.6 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.1.0 |
vmInstanceUuid | String | 虚拟机UUID | 4.1.0 |
l3NetworkUuid | String | 分布式端口组UUID | 4.1.0 |
ip | String | IP地址 | 4.1.0 |
mac | String | MAC地址 | 4.1.0 |
hypervisorType | String | 虚拟化类型 | 4.1.0 |
netmask | String | 子网掩码 | 4.1.0 |
gateway | String | 网关 | 4.1.0 |
metaData | String | 4.1.0 | |
ipVersion | Integer | IP地址版本 | 4.1.0 |
driverType | String | 4.7.13 | |
internalName | String | 4.7.13 | |
deviceId | Integer | 设备ID | 4.1.0 |
type | String | 网卡类型 | 4.1.0 |
state | String | 网卡状态 | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.1.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.1.0 |
usedIps | List | 详情参考usedIps | 4.1.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.1.0 |
ipRangeUuid | String | IP段UUID | 4.1.0 |
l3NetworkUuid | String | 分布式端口组UUID | 4.1.0 |
ipVersion | Integer | IP协议号 | 4.1.0 |
ip | String | IP地址 | 4.1.0 |
netmask | String | 网络掩码 | 4.1.0 |
gateway | String | 网关地址 | 4.1.0 |
usedFor | String | 4.1.0 | |
ipInLong | long | 4.1.0 | |
vmNicUuid | String | 虚拟机网卡UUID | 4.1.0 |
createDate | Timestamp | 创建时间 | 4.1.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.1.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.1.0 |
name | String | 资源名称 | 4.1.0 |
description | String | 资源的详细描述 | 4.1.0 |
primaryStorageUuid | String | 数据存储UUID | 4.1.0 |
vmInstanceUuid | String | 虚拟机UUID | 4.1.0 |
diskOfferingUuid | String | 硬盘规格UUID | 4.1.0 |
rootImageUuid | String | 硬盘根镜像UUID | 4.1.0 |
installPath | String | 硬盘在数据存储上的路径 | 4.1.0 |
type | String | 硬盘类型,数据硬盘/根硬盘 | 4.1.0 |
format | String | 硬盘格式 | 4.1.0 |
size | Long | 硬盘大小 | 4.1.0 |
actualSize | Long | 硬盘真实大小 | 4.1.0 |
deviceId | Integer | 4.1.0 | |
state | String | 硬盘是否开启 | 4.1.0 |
status | String | 硬盘状态 | 4.1.0 |
createDate | Timestamp | 创建时间 | 4.1.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.1.0 |
isShareable | Boolean | 是否共享硬盘 | 4.1.0 |
volumeQos | String | 4.1.0 | |
lastDetachDate | Timestamp | 4.7.13 | |
lastVmInstanceUuid | String | 4.7.13 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
vmInstanceUuid | String | 虚拟机UUID | 4.7.13 |
deviceId | Integer | 4.7.13 | |
isoUuid | String | 4.7.13 | |
isoInstallPath | String | 4.7.13 | |
name | String | 资源名称 | 4.7.13 |
description | String | 资源的详细描述 | 4.7.13 |
createDate | Timestamp | 创建时间 | 4.7.13 |
lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
CreateVmInstanceFromVolumeSnapshotAction action = new CreateVmInstanceFromVolumeSnapshotAction(); action.name = "vm1"; action.description = "this is a vm"; action.instanceOfferingUuid = "6900e329296732aca0e3658bcdcdd3ce"; action.l3NetworkUuids = asList("990ffab4793036d29fc92142889f9ef2"); action.volumeSnapshotUuid = "f81c959344783f19ae4fc76f1e770201"; action.clusterUuid = "cd44bab6f1d43e59bbc885f869e89388"; action.strategy = "InstantStart"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; CreateVmInstanceFromVolumeSnapshotAction.Result res = action.call();
CreateVmInstanceFromVolumeSnapshotAction action = CreateVmInstanceFromVolumeSnapshotAction() action.name = "vm1" action.description = "this is a vm" action.instanceOfferingUuid = "6900e329296732aca0e3658bcdcdd3ce" action.l3NetworkUuids = [990ffab4793036d29fc92142889f9ef2] action.volumeSnapshotUuid = "f81c959344783f19ae4fc76f1e770201" action.clusterUuid = "cd44bab6f1d43e59bbc885f869e89388" action.strategy = "InstantStart" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" CreateVmInstanceFromVolumeSnapshotAction.Result res = action.call()
学习路径
ZStack Cloud 产品学习路径
快速梳理文档,点击相应文本链接,快速跳转到相应文档的页面,学习 ZStack Cloud 产品。
业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1ZStack学院:
training@zstack.io业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io下载链接已发送至您的邮箱。
如未收到,请查看您的垃圾邮件、订阅邮件、广告邮件。 当您收到电子邮件后,请点击 URL 链接,以完成下载。感谢您使用 ZStack 产品和服务。
成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。
信息提交成功。
我们将安排工作人员尽快与您取得联系,请保持电话畅通。感谢您使用 ZStack 产品和服务。
商务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2商务联系:
sales@zstack.io成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。