Skip to main content
Question

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

  • May 20, 2019
  • 4 replies
  • 2037 views

Forum|alt.badge.img+1
Does anyone have a working example?
This topic has been closed for replies.

4 replies

rhunt
Forum|alt.badge.img+4
  • Trailblazer
  • May 20, 2019
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.

Forum|alt.badge.img+1
  • Author
  • Adventurer
  • May 20, 2019
What do you mean by "... the same for snapshots"?

rhunt
Forum|alt.badge.img+4
  • Trailblazer
  • May 21, 2019
I should have clarified:

Snapshots that are part of a protection domain and consistency group.

Forum|alt.badge.img+1
  • Author
  • Adventurer
  • May 21, 2019
That worked. Thanks!