mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #175 from mafigit/add_bridge_interface_support
Add support for bridge interface type
This commit is contained in:
commit
2050efd4d0
@ -70,9 +70,11 @@ module VagrantPlugins
|
|||||||
|
|
||||||
# Configuration for public interfaces which use the macvtap driver
|
# Configuration for public interfaces which use the macvtap driver
|
||||||
if iface_configuration[:iface_type] == :public_network
|
if iface_configuration[:iface_type] == :public_network
|
||||||
template_name = 'public_interface'
|
|
||||||
@device = iface_configuration.fetch(:dev, 'eth0')
|
@device = iface_configuration.fetch(:dev, 'eth0')
|
||||||
|
@type = iface_configuration.fetch(:type, 'direct')
|
||||||
@mode = iface_configuration.fetch(:mode, 'bridge')
|
@mode = iface_configuration.fetch(:mode, 'bridge')
|
||||||
|
@model_type = iface_configuration.fetch(:model_type, 'e1000')
|
||||||
|
template_name = 'public_interface'
|
||||||
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
|
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -147,6 +149,10 @@ module VagrantPlugins
|
|||||||
# Get list of all (active and inactive) libvirt networks.
|
# Get list of all (active and inactive) libvirt networks.
|
||||||
available_networks = libvirt_networks(libvirt_client)
|
available_networks = libvirt_networks(libvirt_client)
|
||||||
|
|
||||||
|
if options[:iface_type] == :public_network
|
||||||
|
return 'public'
|
||||||
|
end
|
||||||
|
|
||||||
if options[:ip]
|
if options[:ip]
|
||||||
address = network_address(options[:ip], options[:netmask])
|
address = network_address(options[:ip], options[:netmask])
|
||||||
available_networks.each do |network|
|
available_networks.each do |network|
|
||||||
@ -157,7 +163,7 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
raise NetworkNotAvailableError, network_name: options[:ip]
|
raise Errors::NetworkNotAvailableError, network_name: options[:ip]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
<interface type='direct'>
|
<interface type='<%= @type %>'>
|
||||||
<% if @mac %>
|
<% if @mac %>
|
||||||
<mac address='<%= @mac %>'/>
|
<mac address='<%= @mac %>'/>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%if @type == 'direct'%>
|
||||||
<source dev='<%= @device %>' mode='<%= @mode %>'/>
|
<source dev='<%= @device %>' mode='<%= @mode %>'/>
|
||||||
|
<% else %>
|
||||||
|
<source bridge='<%=@device%>'/>
|
||||||
|
<model type='<%=@model_type%>'/>
|
||||||
|
<% end %>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user