Creating a vdisk in a specified storage_container via APIv3 | Nutanix Community
Skip to main content

hello @all,

I tried to create a VM with a vdisk on a specified storage_container via APIv3. 

The JSON I entered:

{
"api_version": "3.0",
"metadata":{
"kind":"vm"
},
"spec": {
"cluster_reference": {
"kind": "cluster",
"uuid": "<uuid>"
},
"name": "<name>",
"resources": {
"disk_list":
{
"storage_config": {
"storage_container_reference": {
"kind": "storage_container",
"uuid": "<uuid>",
"name": "<name>"
}
}
},
{
"data_source_reference": {
"kind": "image",
"uuid": "<uuid>"
}
},
{
"disk_size_mib": 10000
}
],
"memory_size_mib": 4096,
"nic_list":
{
"nic_type": "NORMAL_NIC",
"is_connected": true,
"ip_endpoint_list":
{
"ip_type": "DHCP"
}
],
"subnet_reference": {
"kind": "subnet",
"uuid": "<uuid>"
}
}
],
"num_sockets": 1,
"num_vcpus_per_socket": 4,
"power_state": "ON"
}
}
}

After I send this, it did...nothing. I got no error or anything else.

When I remove this part, everything seems to run:

       {
"storage_config": {
"storage_container_reference": {
"kind": "storage_container",
"uuid": "<uuid>",
"name": "<name>"
}
}
},

I only found this but I need it for APIv3.

So, what did I wrong? Is it a syntax-issue by me or a bug? :)

Cheers and thanks for your answers

Referencing container IDs works for disks in general, but not when data source reference is included.

Having raised a support case about this, I received the following feedback:

Unfortunately this is an expected behavior for the current version of AOS/AHV +v3 API. We have an existing improvement logged for some time for this but it is unclear when this is going to be implemented.

 

Their suggestion was using the v2 api. If you only want to use v3, you can move the disks post-VM-creation, using “/vms/mVM UUID]/migrate_disks”. That seemed to work just fine, but is much slower.