Merge pull request #328 from epienbroek/master

Allow the situation where DHCP is not requested but where it is enabled on the virtual network
This commit is contained in:
Dmitry Vasilets 2015-04-02 13:20:21 +02:00
commit 39837bbbaf
2 changed files with 9 additions and 1 deletions

View File

@ -249,6 +249,12 @@ starts with 'libvirt__' string. Here is a list of those options:
* `:mac` - MAC address for the interface.
* `model_type` - parameter specifies the model of the network adapter when you create a domain value by default virtio KVM believe possible values, see the documentation for libvirt
When the option `:libvirt__dhcp_enabled` is to to 'false' it shouldn't matter
whether the virtual network contains a DHCP server or not and vagrant-libvirt
should not fail on it. The only situation where vagrant-libvirt should fail
is when DHCP is requested but isn't configured on a matching already existing
virtual network.
### Public Network Options
* `:dev` - Physical device that the public interface should use. Default is 'eth0'.
* `:mode` - The mode in which the public interface should operate in. Supported

View File

@ -100,8 +100,10 @@ module VagrantPlugins
# match what was configured in the vagrantfile
# since we always enable dhcp for the management network
# this ensures we wont start a vm vagrant cant reach
# Allow the situation where DHCP is not requested (:libvirt__dhcp_enabled == false)
# but where it is enabled on the virtual network
def verify_dhcp
unless @options[:dhcp_enabled] == @interface_network[:dhcp_enabled]
if @interface_network[:dhcp_enabled] == true && @options[:dhcp_enabled] == false
raise Errors::DHCPMismatch,
network_name: @interface_network[:name],
requested: @options[:dhcp_enabled] ? 'enabled' : 'disabled'