Allow shrinking vhdx disk formats for hyperv provider

This commit is contained in:
Brian Cain 2020-04-14 14:33:05 -07:00
parent 82a6c2c8c1
commit f2bcf86aca
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0

View File

@ -123,9 +123,13 @@ module VagrantPlugins
defined_disk_size = disk_actual["Size"]
if defined_disk_size > requested_disk_size
# TODO: Check if disk (maybe use file path) is of type `VHDX`. If not, the disk cannot be shrunk
machine.ui.warn(I18n.t("vagrant.cap.configure_disks.shrink_size_not_supported", name: disk_config.name))
return false
if File.extname(disk_actual["Path"]) == ".vhdx"
# VHDX formats can be shrunk
return true
else
machine.ui.warn(I18n.t("vagrant.cap.configure_disks.shrink_size_not_supported", name: disk_config.name))
return false
end
elsif defined_disk_size < requested_disk_size
return true
else