chef / knife-vsphere

Chef knife plug-in for VMware vSphere
Apache License 2.0
202 stars 124 forks source link

Remove option for - knife vsphere vm vmdk add #449

Open petericebear opened 6 years ago

petericebear commented 6 years ago

Platform Details

Scenario:

Remove vmdk next to the add method functionality.

Hi, Is it possible to create an opposite for adding a vmdk to a vm? Like: knife vsphere vm vmdk remove XX

petericebear commented 6 years ago

I see there is a reconfigeVM option: VirtualMachine.Config.RemoveDisk But I do not see how to leverage that functionality.

When I do: $ knife vsphere vm disk list name-of-the-virtual-machine The output is: 0 Hard disk 1 10.00 GiB 1 Hard disk 2 50.00 GiB 2 Hard disk 3 30.00 GiB

Hope that there is a way to remove disk number 1 or 2 9 (those where added with vmdk add).

petericebear commented 6 years ago

Have something working: https://gist.github.com/petericebear/3640f0b1ee60277e633efe0f36716406

swalberg commented 6 years ago

Hi Peter, we don't have such a command. Kinda surprising, really, seems like it would be helpful.

petericebear commented 6 years ago

Yeah with that script it checks that you dont delete the primary disk (0), but all the others you can delete with: knife vsphere vm disk remove vps-name 1

Where 1 is the disk index show with the disk list command.

swalberg commented 6 years ago

Oh, I didn't see you had a gist... that looks really good! Do you want to put it up as a PR?

Couple of small requests though: can you use SearchHelper to find the VM? See here and here. And instead of puts can you use ui.info, please?