From d54e870752dc0c45c89c1f59b6dbfd92a0159367 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 30 Oct 2019 13:35:21 -0700 Subject: [PATCH] Add file option to disk config --- plugins/kernel_v2/config/disk.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/kernel_v2/config/disk.rb b/plugins/kernel_v2/config/disk.rb index 3b5f351b6..a26ec8ada 100644 --- a/plugins/kernel_v2/config/disk.rb +++ b/plugins/kernel_v2/config/disk.rb @@ -34,6 +34,12 @@ module VagrantPlugins # @return [Integer] attr_accessor :size + # Path to the location of the disk file (Optional) + # + # @return [String] + attr_accessor :file + + # Determines if this disk is the _main_ disk, or an attachment. # Defaults to true. # @@ -64,6 +70,7 @@ module VagrantPlugins @primary = UNSET_VALUE @config = nil @invalid = false + @file = UNSET_VALUE # Internal options @id = SecureRandom.uuid @@ -101,6 +108,7 @@ module VagrantPlugins # by user @type = :disk if @type == UNSET_VALUE @size = nil if @size == UNSET_VALUE + @file = nil if @file == UNSET_VALUE if @primary == UNSET_VALUE @primary = true @@ -130,6 +138,14 @@ module VagrantPlugins errors << "Config option size for disk is not an integer" end + if @file + if !@file.is_a?(String) + errors << "Config option `file` for #{machine.name} disk config is not a string" + else + # Validate that file exists + end + end + errors end