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.
This commit is contained in:
Gerben Meijer 2015-07-24 15:25:47 +02:00
parent fd4efde95e
commit dc2f5cb4aa
3 changed files with 11 additions and 5 deletions

View File

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

View File

@ -28,12 +28,7 @@
<% end %>
<% end %>
<% if @boot_order.count >= 1 %>
<% @boot_order.each do |b| %>
<boot dev='<%= b %>'/>
<% end %>
<bootmenu enable='yes'/>
<% else %>
<boot dev='hd' />
<% end %>
<kernel><%= @kernel %></kernel>
<initrd><%= @initrd %></initrd>
@ -51,6 +46,11 @@
<source file='<%= @domain_volume_path %>'/>
<%# we need to ensure a unique target dev -%>
<target dev='vda' bus='<%= @disk_bus %>'/>
<% if @boot_order[0] == 'hd' %>
<boot order='1'/>
<% elsif @boot_order.count >= 1 %>
<boot order='9'/>
<% end %>
</disk>
<%# additional disks -%>
<% @disks.each do |d| -%>

View File

@ -6,5 +6,10 @@
<target dev='vnet<%= @iface_number %>'/>
<alias name='net<%= @iface_number %>'/>
<model type='<%=@model_type%>'/>
<% if @boot_order[0] == 'network' %>
<boot order='<%= @iface_number+1 %>'/>
<% elsif @boot_order.include?('network') %>
<boot order='<%= @iface_number+2 %>'/>
<% end %>
</interface>