Can I create and attach a vdisk to a VM via Prism Central API? | Nutanix Community
Skip to main content

Hi!

I want to use the Prism Central API to create and connect a vdsik to a VM. The only examples and topics I’ve seen for creating and attaching vdisks uses the Prism Element API, i.e. using a specific CVM as the endpoint.

I don’t want to use a specific CVM as this is to be an orchestrated task triggered by our ITSM system. We can’t rely on a specific CVM to be available and would much rather use Prism Central.

However, I can’t find any API calls that seem to be able to create and attach a vdisk. Maybe the PUT /vms/{uuid} call is capable of this but I can’t see any mention of this in the documentation.

Is there a way to do this with Prism Central?

Hi Martin,

You can create and attach vdisks with Prism Central API. Here the steps you have to follow:

  1. Do a GET for the VM you want to update
  2. From the JSON payload, remove the status key completely
  3. In the spec key, look for disk_list and add an additional item to that list (the new disk). The format is:
{
"device_properties": {
"device_type": "DISK",
"disk_address": {
"adapter_type": "SCSI",
"device_index": 3
}
},
"disk_size_bytes": 3221225472,
"storage_config": {
"storage_container_reference": {
"kind": "storage_container",
"uuid": "c03cd780-32fa-4292-9eab-ab2f9c311328",
"name": "default-container-151523"
}
}
}
  1. Send a PUT with this payload. 

Please let me know if you find any issue.