sprotheroe / vagrant-disksize

Vagrant plugin to resize disks in VirtualBox
MIT License
479 stars 52 forks source link

Issue where plugin is not deleting old disk properly after resizing operation #8

Closed lexusean closed 1 year ago

lexusean commented 7 years ago

Steps to reproduce:

  1. Add vagrant-disksize plugin
  2. Add section to Vagrantfile to resize disk

    resize disk

    if Vagrant.has_plugin?("vagrant-disksize") config.disksize.size = '40GB' end

  3. run 'vagrant up' and wait for machine to come up
  4. run 'vagrant destroy -f'
  5. run 'vagrant up' again. At this point there should be an error message from Virtualbox similar to: "Stderr: VBoxManage.EXE: error: UUID {9e51dfa3-b04f-4bf5-ac33-3358d8e30cff} of the medium 'Y:\VirtualboxVms\dev_box_x\box-disk001.vmdk' does not match the value {7d47d965-34d3-47ab-a738-e9cc4befb7c1} stored in the media registry ('C:\Users\.VirtualBox\VirtualBox.xml')"

This is caused by not closing out the older disk in vboxmanage (closemedium) before deleting.

Created fork and PR to address issue.

ctrlrsf commented 6 years ago

@sprotheroe Any chance we can get this merged? I tested and changes work as expected. Without this, VirtualBox complains that the old .vmdk file is not accessible.

image

image

image

sprotheroe commented 5 years ago

Many thanks for this. I accepted a PR with a very similar but slightly different approach that was more in line with the conventions used elsewhere in the code. Can you confirm this fixes the issues you were seeing?