[DRE-commits] [vagrant-libvirt] 71/104: Specify a MAC address for public_network interface
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Apr 24 13:55:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag 0.0.11
in repository vagrant-libvirt.
commit 1e2f49f028fe74412e4449639304f1aaf7d6fc21
Author: Jevgeni Kiski <jevgeni.kiski at skype.net>
Date: Mon Sep 16 23:26:39 2013 +0300
Specify a MAC address for public_network interface
---
README.md | 6 +++---
lib/vagrant-libvirt/action/create_network_interfaces.rb | 1 +
lib/vagrant-libvirt/templates/interface.xml.erb | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 08b8106..b71fe1c 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ This provider exposes quite a few provider-specific configuration options:
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
* `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
-* `volume_cache` - cache attribute controls the cache mechanism, possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
+* `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
Specific domain settings can be set for each domain separately in multi-VM
environment. Example below shows a part of Vagrantfile, where specific options
@@ -172,7 +172,7 @@ 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 => "eth0", :mode => 'bridge', :mac => '92-c6-8f-94-b5-8d'
end
```
@@ -191,7 +191,7 @@ The second interface is created and bridged into the physical device 'eth0'.
This mechanism uses the macvtap Kernel driver and therefore does not require
an existing bridge device. This configuration assumes that DHCP and DNS services
are being provided by the public network. This public interface should be reachable
-by anyone with access to the public network.
+by anyone with access to the public network. If `:mac` is not defined it will be generated.
### Private Network Options
diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb
index 5c68b42..87eb6b8 100644
--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb
+++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb
@@ -72,6 +72,7 @@ module VagrantPlugins
template_name = 'public_interface'
@device = iface_configuration.fetch(:dev, 'eth0')
@mode = iface_configuration.fetch(:mode, 'bridge')
+ @mac = iface_configuration.fetch(:mac, false)
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
end
diff --git a/lib/vagrant-libvirt/templates/interface.xml.erb b/lib/vagrant-libvirt/templates/interface.xml.erb
index 39edc0f..4e203b0 100644
--- a/lib/vagrant-libvirt/templates/interface.xml.erb
+++ b/lib/vagrant-libvirt/templates/interface.xml.erb
@@ -1,5 +1,8 @@
<interface type='network'>
<source network='<%= @network_name %>'/>
+ <% if @mac %>
+ <mac address='<%= @mac %>'/>
+ <% end %>
<target dev='vnet<%= @iface_number %>'/>
<alias name='net<%= @iface_number %>'/>
<model type='virtio'/>
--
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