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>
This commit is contained in:
Vilmos Nebehaj 2015-03-02 17:44:01 +01:00
parent 52e79ca4d1
commit b51b563c46
3 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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>