From 2176216bf83ffefdd522878ff80ef8b85cb51e3d Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 17 Jan 2020 12:48:56 -0800 Subject: [PATCH] Add error for when disks defined are greater than the max limit --- lib/vagrant/errors.rb | 4 ++++ plugins/providers/virtualbox/cap/configure_disks.rb | 4 +--- templates/locales/en.yml | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 90e5c42c1..ab7584eed 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -904,6 +904,10 @@ module Vagrant error_key(:virtualbox_broken_version_040214) end + class VirtualBoxDisksDefinedExceedLimit < VagrantError + error_key(:virtualbox_disks_defined_exceed_limit) + end + class VirtualBoxGuestPropertyNotFound < VagrantError error_key(:virtualbox_guest_property_not_found) end diff --git a/plugins/providers/virtualbox/cap/configure_disks.rb b/plugins/providers/virtualbox/cap/configure_disks.rb index 7cd17c412..e2845a48c 100644 --- a/plugins/providers/virtualbox/cap/configure_disks.rb +++ b/plugins/providers/virtualbox/cap/configure_disks.rb @@ -19,10 +19,8 @@ module VagrantPlugins return if !Vagrant::Util::Experimental.feature_enabled?("virtualbox_disk_hdd") if defined_disks.size > MAX_DISK_NUMER - # TODO: THORW AN ERROR HERE - # # you can only attach up to 30 disks per controller, INCLUDING the primary disk - raise Exception, "fix me" + raise Vagrant::Errors::VirtualBoxDisksDefinedExceedLimit end machine.ui.info("Configuring storage mediums...") diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 5a7b098a7..6b6e5a9e9 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1641,6 +1641,11 @@ en: 4.2.14 contains a critical bug which prevents it from working with Vagrant. VirtualBox 4.2.16+ fixes this problem. Please upgrade VirtualBox. + virtualbox_disks_defined_exceed_limit: |- + VirtualBox only allows up to 30 disks to be attached to a single guest using the SATA Controller, + including the primray disk. + + Please ensure only up to 30 disks are configured for your guest. virtualbox_guest_property_not_found: |- Could not find a required VirtualBox guest property: %{guest_property}