[DRE-commits] [vagrant-libvirt] 137/163: add information and correct example for bridge. close #330

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:57:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.26
in repository vagrant-libvirt.

commit 1d150173814235285d94820d9f18a79907f9da43
Author: dima <pronix.service at gmail.com>
Date:   Thu Apr 9 07:50:28 2015 +0200

    add information and correct example for bridge. close #330
---
 README.md                                               |  6 +++++-
 lib/vagrant-libvirt/action/create_network_interfaces.rb | 10 ++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index ece0283..1a4f807 100644
--- a/README.md
+++ b/README.md
@@ -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'.
 
diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb
index 8c05cc1..35886ad 100644
--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb
+++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb
@@ -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])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list