From 151f212d508209c143c30cf98dbc71895b5c6864 Mon Sep 17 00:00:00 2001 From: Nick Downs Date: Tue, 10 Sep 2013 22:45:40 -0700 Subject: [PATCH] Added defaults for :dev and :mode. Updated documentation to explain these options. --- README.md | 6 ++++++ lib/vagrant-libvirt/action/create_network_interfaces.rb | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3450c47..eccd59f 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,12 @@ starts with 'libvirt__' string. Here is a list of those options: be forwarded (NATed or routed). Used only when creating new network. By default, all physical interfaces are used. +### Public Network Options +* `:dev` - Physical device that the public interface should use. Default is 'eth0' +* `: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'. + ## Obtaining Domain IP Address Libvirt doesn't provide standard way how to find out an IP address of running diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb index 3fbdebe..5c68b42 100644 --- a/lib/vagrant-libvirt/action/create_network_interfaces.rb +++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb @@ -70,8 +70,9 @@ module VagrantPlugins # Configuration for public interfaces which use the macvtap driver if iface_configuration[:iface_type] == :public_network template_name = 'public_interface' - @device = iface_configuration[:dev] - @mode = iface_configuration[:mode] + @device = iface_configuration.fetch(:dev, 'eth0') + @mode = iface_configuration.fetch(:mode, 'bridge') + @logger.info("Setting up public interface using device #{@device} in mode #{@mode}") end message = "Creating network interface eth#{@iface_number}"