[DRE-commits] [vagrant-libvirt] 120/163: Add 'machine_type' parameter.
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Apr 24 13:57:14 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 b51b563c4614270802f98d263e67eb97ae47e3f3
Author: Vilmos Nebehaj <v.nebehaj at gmail.com>
Date: Mon Mar 2 17:44:01 2015 +0100
Add 'machine_type' parameter.
This parameter will be used by libvirt to set the machine type qemu will
use. For example, setting it to `pc-1.0` will generate this `os`
definition:
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
</os>
---
lib/vagrant-libvirt/action/create_domain.rb | 1 +
lib/vagrant-libvirt/config.rb | 3 +++
lib/vagrant-libvirt/templates/domain.xml.erb | 4 ++++
3 files changed, 8 insertions(+)
diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb
index a552f2e..e200bae 100644
--- a/lib/vagrant-libvirt/action/create_domain.rb
+++ b/lib/vagrant-libvirt/action/create_domain.rb
@@ -28,6 +28,7 @@ module VagrantPlugins
@name = env[:domain_name]
@cpus = config.cpus.to_i
@cpu_mode = config.cpu_mode
+ @machine_type = config.machine_type
@disk_bus = config.disk_bus
@nested = config.nested
@memory_size = config.memory.to_i*1024
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 12e049e..abe4213 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -55,6 +55,7 @@ module VagrantPlugins
attr_accessor :memory
attr_accessor :cpus
attr_accessor :cpu_mode
+ attr_accessor :machine_type
attr_accessor :disk_bus
attr_accessor :nic_model_type
attr_accessor :nested
@@ -91,6 +92,7 @@ module VagrantPlugins
@memory = UNSET_VALUE
@cpus = UNSET_VALUE
@cpu_mode = UNSET_VALUE
+ @machine_type = UNSET_VALUE
@disk_bus = UNSET_VALUE
@nic_model_type = UNSET_VALUE
@nested = UNSET_VALUE
@@ -219,6 +221,7 @@ module VagrantPlugins
@memory = 512 if @memory == UNSET_VALUE
@cpus = 1 if @cpus == UNSET_VALUE
@cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE
+ @machine_type = nil if @machine_type == UNSET_VALUE
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
@nic_model_type = 'virtio' if @nic_model_type == UNSET_VALUE
@nested = false if @nested == UNSET_VALUE
diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb
index 0ac20f1..747ca59 100644
--- a/lib/vagrant-libvirt/templates/domain.xml.erb
+++ b/lib/vagrant-libvirt/templates/domain.xml.erb
@@ -14,7 +14,11 @@
<% end %>
<os>
+ <% if @machine_type %>
+ <type machine='<%= @machine_type %>'>hvm</type>
+ <% else %>
<type>hvm</type>
+ <% end %>
<boot dev='hd'/>
<kernel><%= @kernel %></kernel>
<initrd><%= @initrd %></initrd>
--
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