Check for adapter collisions
This commit is contained in:
parent
20edb5d05a
commit
7982f01f2e
|
@ -46,6 +46,9 @@ module Vagrant
|
||||||
@logger.debug("Assigning adapter locations...")
|
@logger.debug("Assigning adapter locations...")
|
||||||
assign_adapter_locations(adapters)
|
assign_adapter_locations(adapters)
|
||||||
|
|
||||||
|
# Verify that our adapters are good just prior to enabling them.
|
||||||
|
verify_adapters(adapters)
|
||||||
|
|
||||||
# Create all the network interfaces
|
# Create all the network interfaces
|
||||||
@logger.info("Enabling adapters...")
|
@logger.info("Enabling adapters...")
|
||||||
env[:ui].info I18n.t("vagrant.actions.vm.network.preparing")
|
env[:ui].info I18n.t("vagrant.actions.vm.network.preparing")
|
||||||
|
@ -100,6 +103,17 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Verifies that the adapter configurations look good. This will
|
||||||
|
# raise an exception in the case that any errors occur.
|
||||||
|
def verify_adapters(adapters)
|
||||||
|
# Verify that there are no collisions in the adapters being used.
|
||||||
|
used = Set.new
|
||||||
|
adapters.each do |adapter|
|
||||||
|
raise Errors::NetworkAdapterCollision if used.include?(adapter[:adapter])
|
||||||
|
used.add(adapter[:adapter])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Assigns the actual interface number of a network based on the
|
# Assigns the actual interface number of a network based on the
|
||||||
# enabled NICs on the virtual machine.
|
# enabled NICs on the virtual machine.
|
||||||
#
|
#
|
||||||
|
|
|
@ -203,6 +203,11 @@ module Vagrant
|
||||||
error_key(:multi_vm_target_required)
|
error_key(:multi_vm_target_required)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class NetworkAdapterCollision < VagrantError
|
||||||
|
status_code(65)
|
||||||
|
error_key(:adapter_collision, "vagrant.actions.vm.network")
|
||||||
|
end
|
||||||
|
|
||||||
class NetworkCollision < VagrantError
|
class NetworkCollision < VagrantError
|
||||||
status_code(29)
|
status_code(29)
|
||||||
error_key(:collides, "vagrant.actions.vm.host_only_network")
|
error_key(:collides, "vagrant.actions.vm.host_only_network")
|
||||||
|
|
|
@ -395,6 +395,10 @@ en:
|
||||||
MAC address is typically up to the box and box maintiner. Please contact
|
MAC address is typically up to the box and box maintiner. Please contact
|
||||||
the relevant person to solve this issue.
|
the relevant person to solve this issue.
|
||||||
network:
|
network:
|
||||||
|
adapter_collision: |-
|
||||||
|
More than one network have been assigned to the same adapter. At
|
||||||
|
this point this error is actually indicative of an internal error
|
||||||
|
within Vagrant. Please report this as a bug.
|
||||||
configuring: |-
|
configuring: |-
|
||||||
Configuring and enabling network interfaces...
|
Configuring and enabling network interfaces...
|
||||||
no_adapters: |-
|
no_adapters: |-
|
||||||
|
|
Loading…
Reference in New Issue