add information and correct example for bridge. close #330

This commit is contained in:
dima 2015-04-09 07:50:28 +02:00
parent 7f48fca699
commit 1d15017381
2 changed files with 9 additions and 7 deletions

View File

@ -205,7 +205,10 @@ An examples of network interface definitions:
# Public Network
config.vm.define :test_vm1 do |test_vm1|
test_vm1.vm.network :public_network, :dev => "eth0", :mode => 'bridge'
test_vm1.vm.network :public_network,
:dev => "virbr0",
:mode => "bridge",
:type => "bridge"
end
```
@ -264,6 +267,7 @@ virtual network.
* `:mode` - The mode in which the public interface should operate in. Supported
modes are available from the [libvirt documentation](http://www.libvirt.org/formatdomain.html#elementsNICSDirect).
Default mode is 'bridge'.
* `:type` - is type of interface.(`<interface type="#{@type}">`)
* `:mac` - MAC address for the interface.
* `:ovs` - Support to connect to an open vSwitch bridge device. Default is 'false'.

View File

@ -17,8 +17,8 @@ module VagrantPlugins
def initialize(app, env)
@logger = Log4r::Logger.new('vagrant_libvirt::action::create_network_interfaces')
@management_network_name = env[:machine].provider_config.management_network_name
config = env[:machine].provider_config
@nic_model_type = config.nic_model_type
config = env[:machine].provider_config
@nic_model_type = config.nic_model_type
@app = app
end
@ -74,8 +74,8 @@ module VagrantPlugins
# Configuration for public interfaces which use the macvtap driver
if iface_configuration[:iface_type] == :public_network
@device = iface_configuration.fetch(:dev, 'eth0')
@type = iface_configuration.fetch(:type, 'direct')
@mode = iface_configuration.fetch(:mode, 'bridge')
@type = iface_configuration.fetch(:type, 'direct')
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
template_name = 'public_interface'
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
@ -156,9 +156,7 @@ module VagrantPlugins
# Get list of all (active and inactive) libvirt networks.
available_networks = libvirt_networks(libvirt_client)
if options[:iface_type] == :public_network
return 'public'
end
return 'public' if options[:iface_type] == :public_network
if options[:ip]
address = network_address(options[:ip], options[:netmask])