Question

How can I attach a disk from the image service to an exiting VM?

  • 20 May 2019
  • 4 replies
  • 1869 views

Badge +1
Does anyone have a working example?

This topic has been closed for comments

4 replies

Userlevel 2
Badge +4
You can do this with Version 2 of the api but you will need to gather some information about the VM first.
  1. You must have the VM UUID you can get this from the /PrismGateway/services/rest/v2.0/vms/ endpoint {{VM_UUID}}
  2. You must have the vmdisk_uuid of the disk in the Image Services from the endpoint /PrismGateway/services/rest/v2.0/images/ endpoint {{vmDISK_UUID}}
Here is the endpoint where {uuid} is the UUID of the VM that you want to attach the disk to:

/PrismGateway/services/rest/v2.0/vms/{uuid}/disks/attach

Here is an example JSON body for rest call
code:
{
"uuid": "{{VM_UUID}}",
"vm_disks": [
{
"disk_address": {
"device_bus": "SCSI",
"device_index": 1,
"vmdisk_uuid": "{{vmDISK_UUID}}"
},
"is_scsi_pass_through": true,
"is_thin_provisioned": true,
"vm_disk_clone": {
"disk_address": {
"device_bus": "SCSI",
"device_index": 1,
"vmdisk_uuid": "{{vmDISK_UUID}}"
}
}
}
]
}

This is will attach a disk with the specified UUID to the Specified VM as Thin provisioned on scsi.1 interface.

You can add ISOs to CDRoms in the same manner and the same for snapshots.
Badge +1
What do you mean by "... the same for snapshots"?
Userlevel 2
Badge +4
I should have clarified:

Snapshots that are part of a protection domain and consistency group.
Badge +1
That worked. Thanks!