Question

Create VM in specific Container

  • 22 October 2020
  • 8 replies
  • 231 views

Badge

Hello,

I can't find how to specify on which container the disk should be created,

can you help me?
here is my json.

{"spec": {
"name": "TEST-API",
"resources": {
"power_state":"OFF",
"num_vcpus_per_socket": 1,
"num_sockets": 1,
"memory_size_mib": 8192,
"disk_list": [
{
"device_properties": {
"disk_address": {
"device_index": 0,
"adapter_type": "SCSI"
},
"device_type": "DISK"
},
"disk_size_mib": 8192
},
{
"device_properties": {
"disk_address": {
"device_index": 0,
"adapter_type": "IDE"
},
"device_type": "CDROM"
}
}
],
"nic_list":[
{
"nic_type": "NORMAL_NIC",
"is_connected": true,
"ip_endpoint_list": [
{
"ip_type": "DHCP"
}
],
"subnet_reference": {
"kind": "subnet",
"name": "VLAN-130",
"uuid": "002e2b71-a8ca-4360-86e1-0934aa9035f5"
}
}
],
"guest_tools": {
"nutanix_guest_tools": {
"state": "ENABLED",
"iso_mount_state": "MOUNTED"
}
}
},
"cluster_reference": {
"kind": "cluster",
"name": "AA01CLUAHV001",
"uuid": "0005a425-7396-e383-451d-246e960fb6d0"
}
},
"api_version": "3.1.0",
"metadata": {
"kind": "vm"
}
}

Thanks,

Cirvent


8 replies

Userlevel 2
Badge +3

Hi Cirvent,

not sure if i understand your question but you should be able to that easily using acli via ssh on a cvm

acli vm.disk_create <VM-Name> container=<Container-Name> create_size=<Disk-Size>

 

Hope it helps

Badge

Hi UPX,
my problem is that when I create a VM the disk is stored in the wrong container.

Regards,

Userlevel 2
Badge +3

Hi UPX,
my problem is that when I create a VM the disk is stored in the wrong container.

Regards,

If there are no data on disk you can simply delete the original one and create the new one on desired container

Otherwise, If you have data on disk you can create the new one cloning the old but this time on the right container

Badge

Hi,

it is not possible to create the VM with its disk on the right container? 

Regards,

Userlevel 2
Badge +3

Of course you can.

You can select the container to store the disk when you add the new disk to the vm via gui.

Or you can do the same via acli or via api

 

 

Badge

I have no problem in GUI, only via API ,

What should I add to the json file, to indicate the correct container?

Regards,

Userlevel 2
Badge +3

Ok via API, now it’s clear.

You will find all the body content specs here: https://www.nutanix.dev/reference/prism_central/v3/api/vms/postvms/

or here

https://www.nutanix.dev/reference/prism_element/v2/api/vms/post-vms-createvm/

Hope it helps

Userlevel 5
Badge +5

You have at least two places to look for the specs when it comes to APIs:

Nutanix Dev portal (as UPX pointed out earlier)  and

Prism REST API Explorer (only PC has option to browse API v3)

For example:

Nutanix Dev portal:

 

REST API Explorer:

 

Reply