CreateVmInstanceFromVolume
CreateVmInstanceFromVolume
Execution Availability
Try It Out
Submit a mock request using the current auth context and example-driven inputs.
Request Inputs
Body Fields
paramsObjectRequiredRequest body parameter object.
nameStringRequiredThe resource name.
descriptionStringOptional. The detailed description of the resource.
instanceOfferingUuidStringOptional. The instance offering UUID. Note: This parameter is optional if you choose the CPU number and memory size.
cpuNumIntegerOptional. The CPU number or memory size. Note: This parameter is optional if you choose instanceOfferingUuid.
memorySizeLong内存大小,单位为Byte,该参数与instanceOfferingUuid二选一
l3NetworkUuidsListRequiredThe L3 network UUID. Specifies one or more L3 networks. The VM instance will create one NIC on each L3 network.
typeStringOptional. The VM type. The reserved field, which is no need to specify.
volumeUuidStringRequiredThe volume UUID.
platformStringOptional. The volume system platform.
zoneUuidStringOptional. The zone UUID. If specified, the VM instance will will be created in the specified zone.
clusterUuidStringOptional. The cluster UUID. If specified, the VM instance will be created in the specified cluster. The resource priority of this parameter is higher than zoneUuid.
hostUuidStringOptional. The host UUID. If specified, the VM instance will be created in the specified host. The resource priority of this parameter is higher than zoneUuid and clusterUuid.
primaryStorageUuidStringOptional. The primary storage UUID. If specified, the root volume of the VM instance will be created in the specified primary storage.
defaultL3NetworkUuidStringOptional. The default L3 network UUID. When l3NetworkUuids specifies multiple L3 networks, this parameter specifies to provide the default L3 network. If not specified, the first network of l3NetworkUuids will be selected as the default network.
strategyStringOptional. The VM creation strategy. After the VM instance is created, the VM instance is started immediately. After the VM instance is created, the VM instance will not be started.
resourceUuidStringOptional. The resource UUID. If specified, the VM instance will use this field as UUID.
tagUuidsListOptional. The tag UUID list.
systemTagsListOptional. The system tags.
userTagsListOptional. The user tags.
Responses
Endpoint
POST/zstack/v1/vm-instances/from/volume
/zstack/v1/vm-instances/from/volume
Request Example
curl -X POST 'http://{host}/zstack/v1/vm-instances/from/volume' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","instanceOfferingUuid":"<instanceOfferingUuid>","cpuNum":1,"memorySize":1,"l3NetworkUuids":["<l3NetworkUuids>"],"type":"<type>","volumeUuid":"<volumeUuid>","platform":"<platform>","zoneUuid":"<zoneUuid>","clusterUuid":"<clusterUuid>","hostUuid":"<hostUuid>","primaryStorageUuid":"<primaryStorageUuid>","defaultL3NetworkUuid":"<defaultL3NetworkUuid>","strategy":"<strategy>","resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"]},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'
Response Example
200{ "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" } ] } }Change History
This API has no change history records yet.
