From dc2f5cb4aa17da3a301b38171b9ada14ad6f7a41 Mon Sep 17 00:00:00 2001 From: Gerben Meijer Date: Fri, 24 Jul 2015 15:25:47 +0200 Subject: [PATCH] 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 %>