Skip to content

Commit d18fdf7

Browse files
author
Emerson Prado
committed
Implement proper removal of cloned disk
1 parent d514848 commit d18fdf7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/vagrant/disksize/actions.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def ensure_disk_resizable(env)
4444
unless File.exist? new_disk[:file]
4545
clone_as_vdi(driver, old_disk, new_disk)
4646
attach_disk(driver, new_disk)
47-
File.delete(old_disk[:file])
47+
remove_disk(driver, old_disk)
4848
end
4949
end
5050
end
@@ -81,6 +81,10 @@ def attach_disk(driver, disk)
8181
driver.execute('storageattach', @machine.id, '--storagectl', controller, '--port', port, '--device', device, '--type', 'hdd', '--medium', disk[:file])
8282
end
8383

84+
def remove_disk(driver, disk)
85+
driver.execute("closemedium", disk[:file], '--delete')
86+
end
87+
8488
def get_disk_size(driver, disk)
8589
size = nil
8690
driver.execute('showmediuminfo', disk[:file]).each_line do |line|

0 commit comments

Comments
 (0)