diff --git a/README.md b/README.md index 693f683..756a281 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,7 @@ end * `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. * `cpu_mode` - What cpu mode to use for nested virtualization. Defaults to 'host-model' if not set. +* `loader` - Sets path to custom UEFI loader. * `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). * `kernel` - To launch the guest with a kernel residing on host filesystems. Equivalent to qemu `-kernel`. * `initrd` - To specify the initramfs/initrd to use for the guest. Equivalent to qemu `-initrd`. diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb index cf1aa9b..3173716 100644 --- a/lib/vagrant-libvirt/action/create_domain.rb +++ b/lib/vagrant-libvirt/action/create_domain.rb @@ -33,6 +33,7 @@ module VagrantPlugins @name = env[:domain_name] @cpus = config.cpus.to_i @cpu_mode = config.cpu_mode + @loader = config.loader @machine_type = config.machine_type @machine_arch = config.machine_arch @disk_bus = config.disk_bus @@ -123,6 +124,7 @@ module VagrantPlugins env[:ui].info(" -- Domain type: #{@domain_type}") env[:ui].info(" -- Cpus: #{@cpus}") env[:ui].info(" -- Memory: #{@memory_size / 1024}M") + env[:ui].info(" -- Loader: #{@loader}") env[:ui].info(" -- Base box: #{env[:machine].box.name}") env[:ui].info(" -- Storage pool: #{@storage_pool_name}") env[:ui].info(" -- Image: #{@domain_volume_path} (#{env[:box_virtual_size]}G)") diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index a321116..75161b8 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 :loader attr_accessor :boot_order attr_accessor :machine_type attr_accessor :machine_arch @@ -105,6 +106,7 @@ module VagrantPlugins @memory = UNSET_VALUE @cpus = UNSET_VALUE @cpu_mode = UNSET_VALUE + @loader = UNSET_VALUE @machine_type = UNSET_VALUE @machine_arch = UNSET_VALUE @machine_virtual_size = UNSET_VALUE @@ -315,6 +317,7 @@ module VagrantPlugins @memory = 512 if @memory == UNSET_VALUE @cpus = 1 if @cpus == UNSET_VALUE @cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE + @loader = nil if @loader == UNSET_VALUE @machine_type = nil if @machine_type == UNSET_VALUE @machine_arch = nil if @machine_arch == UNSET_VALUE @machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb index dff3458..4908a91 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -27,6 +27,9 @@ hvm <% end %> <% end %> + <% if @loader %> + <%= @loader %> + <% end %> <% if @boot_order.count >= 1 %> <% end %> diff --git a/spec/support/environment_helper.rb b/spec/support/environment_helper.rb index 145c67b..e362d88 100644 --- a/spec/support/environment_helper.rb +++ b/spec/support/environment_helper.rb @@ -19,7 +19,7 @@ class EnvironmentHelper 1024 end - %w(cpus cpu_mode boot_order machine_type disk_bus nested volume_cache kernel cmd_line initrd graphics_type graphics_autoport graphics_port graphics_ip graphics_passwd video_type video_vram keymap storage_pool_name disks cdroms driver inputs).each do |name| + %w(cpus cpu_mode loader boot_order machine_type disk_bus nested volume_cache kernel cmd_line initrd graphics_type graphics_autoport graphics_port graphics_ip graphics_passwd video_type video_vram keymap storage_pool_name disks cdroms driver).each do |name| define_method(name.to_sym) do nil end