From 343a43cae6e2a7a75c9beafe6518b47734e36d56 Mon Sep 17 00:00:00 2001 From: Kevin Blair Date: Tue, 16 Feb 2016 14:57:53 +0000 Subject: [PATCH 1/2] Preserve Disk Image Name detect and preserve the original name of the disk image rather than forcing it to be disk --- plugins/providers/hyperv/action/import.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/providers/hyperv/action/import.rb b/plugins/providers/hyperv/action/import.rb index 0b617ad54..c94e91f0b 100644 --- a/plugins/providers/hyperv/action/import.rb +++ b/plugins/providers/hyperv/action/import.rb @@ -38,10 +38,12 @@ module VagrantPlugins image_path = nil image_ext = nil + image_filename = nil hd_dir.each_child do |f| if %w{.vhd .vhdx}.include?(f.extname.downcase) image_path = f image_ext = f.extname.downcase + image_filename = File.basename(f,image_ext) break end end @@ -92,7 +94,7 @@ module VagrantPlugins env[:ui].detail("Cloning virtual hard drive...") source_path = image_path.to_s - dest_path = env[:machine].data_dir.join("disk#{image_ext}").to_s + dest_path = env[:machine].data_dir.join("#{image_filename}#{image_ext}").to_s FileUtils.cp(source_path, dest_path) image_path = dest_path @@ -103,10 +105,10 @@ module VagrantPlugins image_path: image_path.to_s.gsub("/", "\\") } options[:switchname] = switch if switch - options[:memory] = memory if memory + options[:memory] = memory if memory options[:maxmemory] = maxmemory if maxmemory options[:cpus] = cpus if cpus - options[:vmname] = vmname if vmname + options[:vmname] = vmname if vmname env[:ui].detail("Creating and registering the VM...") server = env[:machine].provider.driver.import(options) From 026243c88b59fd2fcc8a2a49ba03d5b8bb2b5b12 Mon Sep 17 00:00:00 2001 From: Kevin Blair Date: Tue, 16 Feb 2016 14:58:42 +0000 Subject: [PATCH 2/2] Typo Changed message to match HyperV terminology --- plugins/providers/hyperv/action/import.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/providers/hyperv/action/import.rb b/plugins/providers/hyperv/action/import.rb index c94e91f0b..330440f21 100644 --- a/plugins/providers/hyperv/action/import.rb +++ b/plugins/providers/hyperv/action/import.rb @@ -19,7 +19,7 @@ module VagrantPlugins cpus = env[:machine].provider_config.cpus vmname = env[:machine].provider_config.vmname - env[:ui].output("Configured Dynamical memory allocation, maxmemory is #{maxmemory}") if maxmemory + env[:ui].output("Configured Dynamic memory allocation, maxmemory is #{maxmemory}") if maxmemory env[:ui].output("Configured startup memory is #{memory}") if memory env[:ui].output("Configured cpus number is #{cpus}") if cpus env[:ui].output("Configured vmname is #{vmname}") if vmname