From 48eaa93745871afe7f062bb4d0092c7d9ca8644c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 11 Jan 2013 15:56:56 -0800 Subject: [PATCH] Raise proper error if there aren't any NIC slots available --- lib/vagrant/errors.rb | 4 ++++ plugins/providers/virtualbox/action/network.rb | 2 +- templates/locales/en.yml | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index f6be7c111..9665eecea 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -437,6 +437,10 @@ module Vagrant error_key(:virtualbox_invalid_version) end + class VirtualBoxNoRoomForHighLevelNetwork < VagrantError + error_key(:virtualbox_no_room_for_high_level_network) + end + class VirtualBoxNotDetected < VagrantError status_code(8) error_key(:virtualbox_not_detected) diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index cb157020b..f48c3b756 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -51,7 +51,7 @@ module VagrantPlugins slot = options[:adapter] if !slot if available_slots.empty? - # TODO: Error that we have no room for this adapter + raise Vagrant::Errors::VirtualBoxNoRoomForHighLevelNetwork end slot = available_slots.shift diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 2eb4f2c9c..f8dbb3582 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -280,6 +280,13 @@ en: VirtualBox is complaining that the installation is incomplete. Please run `VBoxManage --version` to see the error message which should contain instructions on how to fix this error. + virtualbox_no_room_for_high_level_network: |- + There is no available slots on the VirtualBox VM for the configured + high-level network interfaces. "private_network" and "public_network" + network configurations consume a single network adapter slot on the + VirtualBox VM. VirtualBox limits the number of slots to 8, and it + appears that every slot is in use. Please lower the number of used + network adapters. virtualbox_not_detected: |- Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed. Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires