Hello @DarrenP
There is a provision in v2 API to update a Virtual machine with a vdisk, and specify the vdisk size and container UUID.
So you can simply create a virtual machine and then call this API endpoint to update the VM.
The full API call is
{
"uuid": "string",
"vm_disks": d
{
"disk_address": {
"device_bus": "SCSI",
"device_index": 123,
"device_uuid": "string",
"disk_label": "string",
"is_cdrom": true,
"ndfs_filepath": "string",
"vmdisk_uuid": "string",
"volume_group_uuid": "string"
},
"flash_mode_enabled": true,
"is_cdrom": true,
"is_empty": true,
"is_scsi_pass_through": true,
"is_thin_provisioned": true,
"vm_disk_clone": {
"disk_address": {
"device_bus": "SCSI",
"device_index": 123,
"device_uuid": "string",
"disk_label": "string",
"is_cdrom": true,
"ndfs_filepath": "string",
"vmdisk_uuid": "string",
"volume_group_uuid": "string"
},
"minimum_size": 123,
"snapshot_group_uuid": "string",
"storage_container_uuid": "string"
},
"vm_disk_create": {. <---------------VM Disk create
"size": 123, <-------------Size
"storage_container_uuid": "string" <-------Container
}
}
]
}
You can use this documentation for more info
https://www.nutanix.dev/reference/prism_element/v2/api/vms/post-vms-uuid-disks-attach-attachvmdisk/
Hey Darren,
You’re right it’s not really clear from the formatting provided in the API explorer.
Look for examples of using
"vm_disk_create":{
"storage_container_uuid":"<uuid>",
"size":<size_in_bytes>
… instead of specifying vmdisk UUID.
Keep in mind, for data protection snapshots to work it’s required that all of a VM’s vdisks reside in the same container (excluding attached ISOs in the CDROM drive), so you could run into issues backing up the VM if you create vdisks in different containers.
Cheers guys, that solved the problem.