VMware Cloud Community
jasousa
Contributor
Contributor

delete disks

Dears,

some one, know, can i delete vm's, but dont delete the virtual machines disks, from api's vcloud?

and how to add this vm's disk to another virtual machine?

[]'s

Tags (2)
0 Kudos
4 Replies
depping
Leadership
Leadership

Not sure if you can actually do this through the vCloud API to be honest, I would be surprised if you can...

Duncan (VCDX)

Available now on Amazon: vSphere 4.1 HA and DRS technical deepdive

0 Kudos
admin
Immortal
Immortal

Disks are owned by a virtual machine, so there's no way to delete a VM and leave its disks.  There also is no way to reassign disks to another VM prior to deleting it.

0 Kudos
lamw
Community Manager
Community Manager

You can accomplish this by using the vSphere API which is the underlying API that the vCloud API is built on top of. When removing a virtual disk from a VM, you have the option of just removing it from the VM or deleting the disk all together. What you can do is just remove all the virtual disks associated with a given VM, then issue a delete via vCloud API and in theory (this works fine with just vSphere API) you should have a deleted VM but since the virtual disks are still around, you'll end up with the directory that contains only the VMDKs of that VM

0 Kudos
admin
Immortal
Immortal

vCloud Director considers itself the source of truth for a VM, not vCenter Server.  If you muck with a VM configuration using the vSphere APIs you run the risk of rendering it useless in VCD.

Even if you somehow manage to leave orphaned VMDKs, you don't have a way of attaching them to another vApp/VM using the vCloud API, and if you attempt to do it using the vSphere APIs there's no guarantee they'll be on an accessible datastore.

If your goal is to muck with the internals of a VM, VCD is probably not the abstraction you want to work with, since it's all about taking out the complexity.  At this point, using vSphere only would likely yield better results for your use case.

0 Kudos