From dc2f5cb4aa17da3a301b38171b9ada14ad6f7a41 Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Fri, 24 Jul 2015 15:25:47 +0200 Subject: [PATCH 1/2] Use per device boot order when boot_order is set This allows for network boot with any of the NICs that are defined instead of only from the primary NIC. --- .../action/create_network_interfaces.rb | 1 + lib/vagrant-libvirt/templates/domain.xml.erb | 10 +++++----- lib/vagrant-libvirt/templates/interface.xml.erb | 5 +++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb index cea9d87..88ab821 100644 --- a/lib/vagrant-libvirt/action/create_network_interfaces.rb +++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb @@ -20,6 +20,7 @@ module VagrantPlugins config = env[:machine].provider_config @nic_model_type = config.nic_model_type @nic_adapter_count = config.nic_adapter_count + @boot_order = config.boot_order @app = app end diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb index e1264fb..22a57a9 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -28,12 +28,7 @@ <% end %> <% end %> <% if @boot_order.count >= 1 %> - <% @boot_order.each do |b| %> - - <% end %> - <% else %> - <% end %> <%= @kernel %> <%= @initrd %> @@ -51,6 +46,11 @@ <%# we need to ensure a unique target dev -%> + <% if @boot_order[0] == 'hd' %> + + <% elsif @boot_order.count >= 1 %> + + <% end %> <%# additional disks -%> <% @disks.each do |d| -%> diff --git a/lib/vagrant-libvirt/templates/interface.xml.erb b/lib/vagrant-libvirt/templates/interface.xml.erb index 34ceccd..7086a7f 100644 --- a/lib/vagrant-libvirt/templates/interface.xml.erb +++ b/lib/vagrant-libvirt/templates/interface.xml.erb @@ -6,5 +6,10 @@ + <% if @boot_order[0] == 'network' %> + + <% elsif @boot_order.include?('network') %> + + <% end %> From f47cb7c98b1b3f3deef0af0caa8c1fc59101c838 Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Wed, 29 Jul 2015 13:31:07 +0200 Subject: [PATCH 2/2] Describe changes to boot process due to boot order --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ee2e53..e4d5180 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,7 @@ end * `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`. * `machine_virtual_size` - Sets the disk size in GB for the machine overriding the default specified in the box. Allows boxes to defined with a minimal size disk by default and to be grown to a larger size at creation time. Will ignore sizes smaller than the size specified by the box metadata. Note that currently there is no support for automatically resizing the filesystem to take advantage of the larger disk. -* `boot` - Change the boot order and enables the boot menu. Possible options are "hd" or "network". Defaults to "hd" with boot menu disabled. +* `boot` - Change the boot order and enables the boot menu. Possible options are "hd" or "network". Defaults to "hd" with boot menu disabled. When "network" is set first, *all* NICs will be tried before the first disk is tried. * `nic_adapter_count` - Defaults to '8'. Only use case for increasing this count is for VMs that virtualize switches such as Cumulus Linux. Max value for Cumulus Linux VMs is 33.