mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Auto configuration for tunnel interfaces
This commit is contained in:
parent
ae1d0667df
commit
c387864dd2
@ -194,7 +194,7 @@ module VagrantPlugins
|
||||
# It's used for provisioning and it has to be available during provisioning,
|
||||
# ifdown command is not acceptable here.
|
||||
next if slot_number.zero?
|
||||
next if options[:auto_config] === false
|
||||
next if !options[:auto_config]
|
||||
@logger.debug "Configuring interface slot_number #{slot_number} options #{options}"
|
||||
|
||||
network = {
|
||||
@ -214,9 +214,6 @@ module VagrantPlugins
|
||||
network[:type] = :dhcp
|
||||
end
|
||||
|
||||
# do not run configure_networks for tcp tunnel interfaces
|
||||
next if options.fetch(:tunnel_type, nil)
|
||||
|
||||
networks_to_configure << network
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,15 @@
|
||||
require 'ipaddr'
|
||||
require 'nokogiri'
|
||||
require 'vagrant/util/network_ip'
|
||||
|
||||
class IPAddr
|
||||
def get_mask
|
||||
if @addr
|
||||
_to_string(@mask_addr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module VagrantPlugins
|
||||
module ProviderLibvirt
|
||||
module Util
|
||||
@ -102,14 +111,18 @@ module VagrantPlugins
|
||||
# store type in options
|
||||
# use default values if not already set
|
||||
options = {
|
||||
iface_type: type,
|
||||
netmask: '255.255.255.0',
|
||||
iface_type: type,
|
||||
netmask: options[:network_address] ?
|
||||
IPAddr.new(options[:network_address]).get_mask :
|
||||
'255.255.255.0',
|
||||
dhcp_enabled: true,
|
||||
forward_mode: 'nat'
|
||||
}.merge(options)
|
||||
|
||||
if options[:type].to_s == 'dhcp' && options[:ip].nil?
|
||||
options[:network_name] = 'vagrant-private-dhcp'
|
||||
options[:network_name] = options[:network_name] ?
|
||||
options[:network_name] :
|
||||
'vagrant-private-dhcp'
|
||||
end
|
||||
|
||||
# add to list of networks to check
|
||||
|
Loading…
Reference in New Issue
Block a user