diff --git a/README.md b/README.md index 0e0cd49..d2cbba7 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ end * `keymap` - Set keymap for vm. default: en-us * `video_vram` - Used by some graphics card types to vary the amount of RAM dedicated to video. Defaults to 9216. * `machine` - Sets machine type. Equivalent to qemu `-machine`. Use `qemu-system-x86_64 -machine help` to get a list of supported machines. +* `machine_arch` - Sets machine architecture. This helps libvirt to determine the correct emulator type. Possible values depend on your version of qemu. For possible values, see which emulator executable `qemu-system-*` your system provides. Common examples are `aarch64`, `alpha`, `arm`, `cris`, `i386`, `lm32`, `m68k`, `microblaze`, `microblazeel`, `mips`, `mips64`, `mips64el`, `mipsel`, `moxie`, `or32`, `ppc`, `ppc64`, `ppcemb`, `s390x`, `sh4`, `sh4eb`, `sparc`, `sparc64`, `tricore`, `unicore32`, `x86_64`, `xtensa`, `xtensaeb`. Specific domain settings can be set for each domain separately in multi-VM diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb index 428f524..740cc46 100644 --- a/lib/vagrant-libvirt/action/create_domain.rb +++ b/lib/vagrant-libvirt/action/create_domain.rb @@ -34,6 +34,7 @@ module VagrantPlugins @cpus = config.cpus.to_i @cpu_mode = config.cpu_mode @machine_type = config.machine_type + @machine_arch = config.machine_arch @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 c2543dc..c52eca2 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -56,6 +56,7 @@ module VagrantPlugins attr_accessor :cpus attr_accessor :cpu_mode attr_accessor :machine_type + attr_accessor :machine_arch attr_accessor :disk_bus attr_accessor :nic_model_type attr_accessor :nested @@ -95,6 +96,7 @@ module VagrantPlugins @cpus = UNSET_VALUE @cpu_mode = UNSET_VALUE @machine_type = UNSET_VALUE + @machine_arch = UNSET_VALUE @disk_bus = UNSET_VALUE @nic_model_type = UNSET_VALUE @nested = UNSET_VALUE @@ -277,6 +279,7 @@ module VagrantPlugins @cpus = 1 if @cpus == UNSET_VALUE @cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE @machine_type = nil if @machine_type == UNSET_VALUE + @machine_arch = nil if @machine_arch == 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 3f06c78..1d01a89 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -14,11 +14,19 @@ <% end %> - <% if @machine_type %> - hvm - <% else %> - hvm - <% end %> + <% if @machine_type %> + <% if @machine_arch %> + hvm + <% else %> + hvm + <% end %> + <% else %> + <% if @machine_arch %> + hvm + <% else %> + hvm + <% end %> + <% end %> <%= @kernel %> <%= @initrd %>