mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Make lookup_network_by_name the default for veryisolated networks
This commit is contained in:
parent
9b7c9def3c
commit
fc24db479f
@ -133,27 +133,27 @@ module VagrantPlugins
|
|||||||
# Set IP address of network (actually bridge). It will be used as
|
# Set IP address of network (actually bridge). It will be used as
|
||||||
# gateway address for machines connected to this network.
|
# gateway address for machines connected to this network.
|
||||||
net = IPAddr.new(net_address)
|
net = IPAddr.new(net_address)
|
||||||
end
|
|
||||||
|
|
||||||
@interface_network[:network_address] = net_address
|
|
||||||
|
|
||||||
# Default to first address (after network name)
|
# Default to first address (after network name)
|
||||||
@interface_network[:ip_address] = @options[:host_ip].nil? ? \
|
@interface_network[:ip_address] = @options[:host_ip].nil? ? \
|
||||||
net.to_range.begin.succ : \
|
net.to_range.begin.succ : \
|
||||||
IPAddr.new(@options[:host_ip])
|
IPAddr.new(@options[:host_ip])
|
||||||
|
|
||||||
# Is there an available network matching to configured ip
|
|
||||||
# address?
|
|
||||||
if net_address
|
|
||||||
network = lookup_network_by_ip(net_address)
|
|
||||||
@interface_network = network if network
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# if network is veryisolated, search by name instead
|
@interface_network[:network_address] = net_address
|
||||||
if !@interface_network and @options[:libvirt__forward_mode] == "veryisolated"
|
|
||||||
|
# if network is veryisolated, search by name
|
||||||
|
if @options[:libvirt__forward_mode] == "veryisolated"
|
||||||
|
network = lookup_network_by_name(@options[:network_name])
|
||||||
|
elsif net_address
|
||||||
|
# otherwise, search by ip (if set)
|
||||||
|
network = lookup_network_by_ip(net_address)
|
||||||
|
else
|
||||||
|
# leaving this here to mimic prior behavior. If we get
|
||||||
|
# here, something's probably broken.
|
||||||
network = lookup_network_by_name(@options[:network_name])
|
network = lookup_network_by_name(@options[:network_name])
|
||||||
@interface_network = network if network
|
|
||||||
end
|
end
|
||||||
|
@interface_network = network if network
|
||||||
|
|
||||||
if @interface_network[:created]
|
if @interface_network[:created]
|
||||||
verify_dhcp
|
verify_dhcp
|
||||||
|
Loading…
Reference in New Issue
Block a user