创建一个新的云主机。
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 | |
type (可选) | String | body(包含在params结构中) | 云主机类型
|
| 0.6 |
rootDiskOfferingUuid (可选) | String | body(包含在params结构中) | 根云盘规格UUID
| 0.6 | |
dataDiskSizes (可选) | List | body(包含在params结构中) | 自定义云盘大小列表。可以指定一个或多个云盘大小(可重复)为云主机创建一个或多个数据云盘。 | 4.4.24 | |
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 | ||
reservedMemorySize (可选) | Long | body(包含在params 结构中) | 4.7.21 |
affinityGroupUuid::UUID
affinityGroupUuid::5fd71606d5af451d981413f35367a8d6
pciDevice::UUID
pciDevice::634b48a7bca139d9944a0f95b0c2dddf
vmCpuPinning::绑定策略
vmCpuPinning::1:3;1-3:4-7,^6
userdata::脚本的base64编码
userdata::I2Nsb3VkLWNvbmZpZwp1c2VyczoKIC0gbmFtZTogdGVzdAogICBzaGVsbDogL2Jpbi9iYXNoCiAgIGdyb3VwczogdXNlcnMKICAgc3VkbzogWydBTEw9KEFMTCkgTk9QQVNTV0Q6QUxMJ10KICAgc3NoLWF1dGhvcml6ZWQta2V5czoKICAgICAgIC0gc3NoLXJzYSBBQUFBQjNOemFDMUxYQ0pmanJvRDFsVCByb290QDEwLTAtMC0xOApib290Y21kOgogLSBta2RpciAvdG1wL3RlbXAgCndyaXRlX2ZpbGVzOgogLSBwYXRoOiAvdG1wL1pTdGFja19jb25maWcKICAgY29udGVudDogfAogICAgICAgSGVsbG8sd29ybGQhCiAgIHBlcm1pc3Npb25zOiAnMDc1NScKaG9zdG5hbWU6IFBlcmYtdGVzdApkaXNhYmxlX3Jvb3Q6IGZhbHNlCnNzaF9wd2F1dGg6IHllcwpjaHBhc3N3ZDoKICBsaXN0OiB8CiAgICAgIHJvb3Q6d29yZAogIGV4cGlyZTogRmFsc2UKcnVuY21kOgogLSBlY2hvIGxzIC1sIC8gPi9yb290L2xpc3Quc2g=
sshkey::公钥内容
sshkey::ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPAGDmLG2yW1fGQsek4PdBL6wiVMHuLrl566ITPAf8A2Oi5BaExoUwdPjA96OaUSrtlsKlrXUMGEJwN1r1TrL9JdUMg7jww3QysGuS3P+bRsBe1TSGHS8LNc9JY9HpoL4ZN/j0zTaZfju9eDzbVsbDrF91x3yDeeGH6IG6gWJn96HPfrlg7REfo04eBdflsTaaFC0lAXoBOrnGVnzRdQfwTNRGmMAyFzCV83HOhVzBJuL5VqtAT8a0lSC4QgZTNROh6zbkTUUYYQu0QS65EaJCTyAhksuidRzyjLX3p3oMileKdJNugRa5IDHhGJXExIK+58Nvaqfj/03yN8IfO7sj root@hpe-77
ha::NeverStop
ha::NeverStop
vmConsoleMode::控制台模式
vmConsoleMode::spice或者vmConsoleMode::vnc
usbRedirect::true
usbRedirect::true
consolePassword::控制台密码
consolePassword::123456
staticIp::三层网络UUID::指定的IP
staticIp::f00d593dff2e4bd58473388ac411ade2::192.168.0.10
customMac::三层网络UUID::指定的MAC地址
customMac::81a21a81cde84c1084c191354053a3b5::fa:00:37:ee:9f:00
volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning
volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning
ceph::rootPoolName::xxx, 其中xxx代表池名称
ceph::rootPoolName::pri-v-r-26e11ca6814d4e1ba504d845f7848db3
vmMachineType::xx, 其中xx代表pc或q35
vmMachineType::pc
cdroms::${cdrom-1 config}::${cdrom-2 config}::${cdrom-3 config}
,cdrom config有三种可选择值: iso uuid(cdrom想要加载的iso uuid),empty(不选择任何iso),none(不配置光驱)。cdrom: cdroms::empty::none::none
cdrom: cdroms::empty::empty::empty
cdrom:cdroms::iso_1_uuid::iso_2_uuid::iso_3_uuid
createWithoutCdRom::true
createWithoutCdRom::true
mdevDevice::MDEV_DEV_UUID
mdevDevice::e2af8f869eff49d2a3d6f86cadc27090
autoReleaseSpecReleatedPhysicalPciDevice
autoReleaseSpecReleatedPhysicalPciDevice
autoReleaseSpecReleatedVirtualPciDevice
autoReleaseSpecReleatedVirtualPciDevice
mdevDeviceSpec::MDEV_SPEC_UUID::MDEV_DEV_NUM
mdevDeviceSpec::e2af8f869eff49d2a3d6f86cadc27090::4
pciDeviceSpec::PCI_SPEC_UUID::PCI_DEV_NUM
pciDeviceSpec::e2af8f869eff49d2a3d6f86cadc27090::4
vmPriority::PRIORITY_LEVEL
,其中PRIORITY_LEVEL可以为Normal/HighvmPriority::Normal
GuestTools::TOOLS_VERSION
,其中TOOLS_VERSION初值为1.0.0,未来随着工具版本的提升,这个值会随之变化。GuestTools::1.0.0
resourceBindings::Cluster:clusterUuid
,其中clusterUuid为对应的集群uuidresourceBindings::Cluster:2sdasf231jvznsdak
hostname::xxxxx
,其中xxxxx就是用户设置的主机名hostname::host.cloud.org
enableSRIOV::{L3_NETWORK_UUID}
enableSRIOV::9e19dafe81c64fed8e34f72e27582339
driver::virtio
driver::virtio
vmNumaEnable::boolean
vmNumaEnable::true
vmEmulatorPinning::CPU
vmEmulatorPinning::1,2,3,4,5,6,7
xmlhook::{xmlhookUuid}
xmlhook::35a678b482514da5aee22a6ab17d71e1
{ "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 |
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 |
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 | |
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 |
{ "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": 8.589934592E9, "cpuNum": 1.0, "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.0, "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": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f54fc6d488133688a6a7635f5c44a288/f54fc6d488133688a6a7635f5c44a288.qcow2", "type": "Root", "format": "qcow2", "size": 1.073741824E11, "actualSize": 2.147483648E10, "deviceId": 0.0, "state": "Enabled", "status": "Ready", "createDate": "Nov 14, 2017 10:20:57 PM", "lastOpDate": "Nov 14, 2017 10:20:57 PM" } ] } }
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
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 | |
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 | |
vmNics | List | 详情参考vmNics | 3.10.0 |
allVolumes | List | 详情参考allVolumes | 3.10.0 |
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
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 |
deviceId | Integer | 设备ID | 3.10.0 |
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 | 云盘Qos,格式如total=1048576 | 3.10.0 |
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()
学习路径
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 产品和服务。