VMware Python SDK or REST API - How to increase VM's disk size?

Viewed 253

How to increase vm disk capacity using Python vSphere Automation SDK or REST API? I'm new to the SDK and can't find any documentation or code sample on how to increase a VM's disk capacity. Any pointers?

I also tried the REST API but it doesn't seem to take the 'capacity' attribute in the request and keep getting 400 error:

I followed this REST API:

https://developer.vmware.com/apis/vsphere-automation/v7.0U1/vcenter/rest/vcenter/vm/vm/hardware/disk/disk/patch/

curl -kv --location --request PATCH 'https://{vcenterurl}/rest/vcenter/vm/vm-22/hardware/disk/4000' \
--header 'vmware-api-session-id: 826f459a3ec1a8cd8b8fc3797a6818fe' \
--header 'Content-Type: application/json' \
--header 'Cookie: vmware-api-session-id=826f459a3ec1a8cd8b8fc3797a6818dc' \
--data-raw '{
"spec": {
"backing": {
"vmdk_file": "[DS10] myVM.vmdk",
"type": "VMDK_FILE",
},
"capacity": 64424509440,
}
}'
0 Answers
Related