diff --git a/lib/vagrant/action/vm/network.rb b/lib/vagrant/action/vm/network.rb index 0a6a0a1a2..d27fd549e 100644 --- a/lib/vagrant/action/vm/network.rb +++ b/lib/vagrant/action/vm/network.rb @@ -90,6 +90,11 @@ module Vagrant adapters.each do |adapter| # Ignore the adapters that already have been assigned if !adapter[:adapter] + # If we have no available adapters, then that is an exceptional + # event. + raise Errors::NetworkNoAdapters if available.empty? + + # Otherwise, assign as the adapter the next available item adapter[:adapter] = available.shift end end diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index bcee636b4..e4f5b0c38 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -208,6 +208,11 @@ module Vagrant error_key(:collides, "vagrant.actions.vm.host_only_network") end + class NetworkNoAdapters < VagrantError + status_code(64) + error_key(:no_adapters, "vagrant.actions.vm.network") + end + class NetworkNotFound < VagrantError status_code(30) error_key(:not_found, "vagrant.actions.vm.host_only_network") diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b84abde13..311c69a37 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -395,10 +395,15 @@ en: MAC address is typically up to the box and box maintiner. Please contact the relevant person to solve this issue. network: - preparing: |- - Preparing network interfaces based on configuration... configuring: |- Configuring and enabling network interfaces... + no_adapters: |- + No available adapters on the virtual machine were found to accomodate + for all configured networks. VirtualBox virtual machines have 8 + network interfaces available usually, so please lower the number of + networks to below 8. + preparing: |- + Preparing network interfaces based on configuration... host_only_network: collides: |- The specified host network collides with a non-hostonly network!