mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #642 from borisroman/add/portgroup_public
Add libvirt portgroup support.
This commit is contained in:
commit
9e9811de8a
@ -431,6 +431,8 @@ virtual network.
|
||||
Default mode is 'bridge'.
|
||||
* `:type` - is type of interface.(`<interface type="#{@type}">`)
|
||||
* `:mac` - MAC address for the interface.
|
||||
* `:network_name` - Name of libvirt network to connect to.
|
||||
* `:portgroup` - Name of libvirt portgroup to connect to.
|
||||
* `:ovs` - Support to connect to an open vSwitch bridge device. Default is 'false'.
|
||||
|
||||
### Management Network
|
||||
|
@ -77,6 +77,8 @@ module VagrantPlugins
|
||||
@mode = iface_configuration.fetch(:mode, 'bridge')
|
||||
@type = iface_configuration.fetch(:type, 'direct')
|
||||
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
||||
@portgroup = iface_configuration.fetch(:portgroup, nil)
|
||||
@network_name = iface_configuration.fetch(:network_name, @network_name)
|
||||
template_name = 'public_interface'
|
||||
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
|
||||
@ovs = iface_configuration.fetch(:ovs, false)
|
||||
@ -125,6 +127,8 @@ module VagrantPlugins
|
||||
if iface_configuration[:iface_type] == :public_network
|
||||
if @type == 'direct'
|
||||
@mac = xml.xpath("/domain/devices/interface[source[@dev='#{@device}']]/mac/@address")
|
||||
elsif !@portgroup.nil?
|
||||
@mac = xml.xpath("/domain/devices/interface[source[@network='#{@network_name}']]/mac/@address")
|
||||
else
|
||||
@mac = xml.xpath("/domain/devices/interface[source[@bridge='#{@device}']]/mac/@address")
|
||||
end
|
||||
|
@ -4,6 +4,8 @@
|
||||
<% end %>
|
||||
<%if @type == 'direct'%>
|
||||
<source dev='<%= @device %>' mode='<%= @mode %>'/>
|
||||
<% elsif !@portgroup.nil? %>
|
||||
<source network='<%=@network_name%>' portgroup='<%=@portgroup%>'/>
|
||||
<% else %>
|
||||
<source bridge='<%=@device%>'/>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user