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,
|
# It's used for provisioning and it has to be available during provisioning,
|
||||||
# ifdown command is not acceptable here.
|
# ifdown command is not acceptable here.
|
||||||
next if slot_number.zero?
|
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}"
|
@logger.debug "Configuring interface slot_number #{slot_number} options #{options}"
|
||||||
|
|
||||||
network = {
|
network = {
|
||||||
@ -214,9 +214,6 @@ module VagrantPlugins
|
|||||||
network[:type] = :dhcp
|
network[:type] = :dhcp
|
||||||
end
|
end
|
||||||
|
|
||||||
# do not run configure_networks for tcp tunnel interfaces
|
|
||||||
next if options.fetch(:tunnel_type, nil)
|
|
||||||
|
|
||||||
networks_to_configure << network
|
networks_to_configure << network
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
|
require 'ipaddr'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'vagrant/util/network_ip'
|
require 'vagrant/util/network_ip'
|
||||||
|
|
||||||
|
class IPAddr
|
||||||
|
def get_mask
|
||||||
|
if @addr
|
||||||
|
_to_string(@mask_addr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module ProviderLibvirt
|
module ProviderLibvirt
|
||||||
module Util
|
module Util
|
||||||
@ -102,14 +111,18 @@ module VagrantPlugins
|
|||||||
# store type in options
|
# store type in options
|
||||||
# use default values if not already set
|
# use default values if not already set
|
||||||
options = {
|
options = {
|
||||||
iface_type: type,
|
iface_type: type,
|
||||||
netmask: '255.255.255.0',
|
netmask: options[:network_address] ?
|
||||||
|
IPAddr.new(options[:network_address]).get_mask :
|
||||||
|
'255.255.255.0',
|
||||||
dhcp_enabled: true,
|
dhcp_enabled: true,
|
||||||
forward_mode: 'nat'
|
forward_mode: 'nat'
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
if options[:type].to_s == 'dhcp' && options[:ip].nil?
|
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
|
end
|
||||||
|
|
||||||
# add to list of networks to check
|
# add to list of networks to check
|
||||||
|
Loading…
Reference in New Issue
Block a user