Add virtualbox cleanup_disks action

This commit is contained in:
Brian Cain 2020-01-14 10:15:57 -08:00
parent cc8ed8a616
commit e4a57a8e1d
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
3 changed files with 25 additions and 0 deletions

View File

@ -12,6 +12,7 @@ module Vagrant
autoload :BoxCheckOutdated, "vagrant/action/builtin/box_check_outdated"
autoload :BoxRemove, "vagrant/action/builtin/box_remove"
autoload :Call, "vagrant/action/builtin/call"
autoload :CleanupDisks, "vagrant/action/builtin/cleanup_disks"
autoload :Confirm, "vagrant/action/builtin/confirm"
autoload :ConfigValidate, "vagrant/action/builtin/config_validate"
autoload :DestroyConfirm, "vagrant/action/builtin/destroy_confirm"

View File

@ -79,6 +79,7 @@ module VagrantPlugins
b.use ForwardPorts
b.use SetHostname
b.use SaneDefaults
b.use CleanupDisks
b.use Disk
b.use Customize, "pre-boot"
b.use Boot

View File

@ -0,0 +1,23 @@
require "log4r"
require "vagrant/util/numeric"
require "vagrant/util/experimental"
module VagrantPlugins
module ProviderVirtualBox
module Cap
module CleanupDisks
LOGGER = Log4r::Logger.new("vagrant::plugins::virtualbox::cleanup_disks")
# @param [Vagrant::Machine] machine
# @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_disks
def self.cleanup_disks(machine, defined_disks)
return if defined_disks.empty?
return if !Vagrant::Util::Experimental.feature_enabled?("virtualbox_disk_hdd")
end
protected
end
end
end
end