I’m having the exact same issue, have you made any headway?
Hi LiTian, nsocwx,
Here is an example of how to update a VM disk. Please have a look and let me know if you have any question.
https://github.com/pipoe2h/calm-dsl/blob/dev-platform/blueprints/dev-platform/scripts/escript/expand_disk.py
Hi LiTian, nsocwx,
Here is an example of how to update a VM disk. Please have a look and let me know if you have any question.
https://github.com/pipoe2h/calm-dsl/blob/dev-platform/blueprints/dev-platform/scripts/escript/expand_disk.py
This works. Thank you! I tried REST API V2 using what I thought might be equivalent to your method in V3. I used parameter ‘size’ (and later ‘disk_size_mib’) and it returned 200. But disk size stayed the same. Then I guess this feature just doesn’t work in V2? Any idea how it may work there?
Hi LiTian,
It’s possible with API V2 too. Here an example:
curl -k -u admin --request PUT 'https://<PE_VIP>:9440/PrismGateway/services/rest/v2.0/vms/<VM_UUID>/disks/update' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data-raw '{"vm_disks":"{"disk_address":{"vmdisk_uuid":"1d6d63de-e9a1-48ec-bcde-d1318d0a35af","device_uuid":"4d7bf055-748f-4c42-9606-bbcb486a3e1f","device_index":0,"device_bus":"scsi"},"flash_mode_enabled":false,"is_cdrom":false,"is_empty":false,"vm_disk_create":{"storage_container_uuid":"cf074530-5cff-408e-8db5-bac30a12d2b5","size":6442450944}}]}'
The size has to be bytes. Please let us know how it goes.
Hi LiTian,
It’s possible with API V2 too. Here an example:
curl -k -u admin --request PUT 'https://<PE_VIP>:9440/PrismGateway/services/rest/v2.0/vms/<VM_UUID>/disks/update' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data-raw '{"vm_disks":"{"disk_address":{"vmdisk_uuid":"1d6d63de-e9a1-48ec-bcde-d1318d0a35af","device_uuid":"4d7bf055-748f-4c42-9606-bbcb486a3e1f","device_index":0,"device_bus":"scsi"},"flash_mode_enabled":false,"is_cdrom":false,"is_empty":false,"vm_disk_create":{"storage_container_uuid":"cf074530-5cff-408e-8db5-bac30a12d2b5","size":6442450944}}]}'
The size has to be bytes. Please let us know how it goes.
This is exactly what I wanted! Works like a charm. Thank you so much! I’d also like to mark this as an answer as not everyone uses Prism Central.
Hi There,
Suppose I wish to extend the VM disk from 2 GB to 10 GB using the rest API with Curl command, How I do that. The available API by Nutanix is not extending the disk its only updating the VM. I can see the changes in Recent task in console.
When I do using GUI the operation shows VM disk update.
But when I do using the API I get only VM update in console.
Using the PUT
https://192.168.1.1:9440/PrismGateway/services/rest/v2.0/virtual_disks/
Thank you
@sumitsk Jose’s solution works for me. I think it should be ‘vms/<VM_UUID>/disks’ rather than ‘virtual_disks’. Did you have all the essential parameters, e.g. --raw-data {}, in your command? Can you show your full curl command?
Right now I am testing it inbuild API in nutanix API Explorer.
I am pasting the PUT inputs
{"alert_summary":{"alert_summaries":{},"count":0},"attached_vm_id":"0005d577-2961-75d0-191a-005056add60e::35dcbc29-0889-4b54-8793-706d785ec4d3","attached_vm_uuid":"35dcbc29-0889-4b54-8793-706d785ec4d3","attached_vmname":"REDHAT_8","attached_volume_group_id":"null","cluster_uuid":"0005d577-2961-75d0-191a-005056add60e","device_uuid":"58e91622-e210-4be8-9ff4-3703c5b0a558","disk_address":"scsi.1","disk_capacity_in_bytes":1234567890,"flash_mode_enabled":true,"health_summary":{},"nutanix_nfsfile_path":"/AIT_Container/.acropolis/vmdisk/c0f461dd-7d95-4899-ad2a-9dbe394953d8","stats":{},"usage_stats":{},"uuid":"c0f461dd-7d95-4899-ad2a-9dbe394953d8","virtual_disk_id":"0005d577-2961-75d0-191a-005056add60e::c0f461dd-7d95-4899-ad2a-9dbe394953d8"}
Above one is I am using to give in PUT input inbuilt API.
Task is to extend the second disk which is 3GB and make it 4 GB to 5 GB.
(scsi.1)
Thank you
Sumit
@sumitsk Can you try the PUT method with /vms/<VM_UUID>/disks, instead of /virtual_disks/ ? I think it will make a difference. Here’s the usage:
https://www.nutanix.dev/reference/prism_element/v2/api/vms/put-vms-uuid-disks-update-updatedisk
Have something like this in ‘body’:
"vm_disks":d{"disk_address":{"vmdisk_uuid":"1d6d63de-e9a1-48ec-bcde-d1318d0a35af","device_uuid":"4d7bf055-748f-4c42-9606-bbcb486a3e1f","device_index":0,"device_bus":"scsi"},"flash_mode_enabled":false,"is_cdrom":false,"is_empty":false,"vm_disk_create":{"storage_container_uuid":"cf074530-5cff-408e-8db5-bac30a12d2b5","size":6442450944}}]
Replace values with yours. Note that even though the parameter says “vm_disk_create”, it’s actually enlarging the designated.
Thanks for your input but some errors are there.
I am looking into errors to sort out them.
Thank you