Allow custom name for disk device

This is needed for example for xen in full virtualisation mode
as it won't allow the default vda
This commit is contained in:
Michal Sylwester
2017-01-30 17:06:31 +01:00
parent ecea549e7f
commit 07dbb907bd
6 changed files with 11 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ module VagrantPlugins
@machine_type = config.machine_type
@machine_arch = config.machine_arch
@disk_bus = config.disk_bus
@disk_device = config.disk_device
@nested = config.nested
@memory_size = config.memory.to_i * 1024
@management_network_mac = config.management_network_mac

View File

@@ -71,6 +71,7 @@ module VagrantPlugins
attr_accessor :machine_arch
attr_accessor :machine_virtual_size
attr_accessor :disk_bus
attr_accessor :disk_device
attr_accessor :nic_model_type
attr_accessor :nested
attr_accessor :volume_cache
@@ -170,6 +171,7 @@ module VagrantPlugins
@machine_arch = UNSET_VALUE
@machine_virtual_size = UNSET_VALUE
@disk_bus = UNSET_VALUE
@disk_device = UNSET_VALUE
@nic_model_type = UNSET_VALUE
@nested = UNSET_VALUE
@volume_cache = UNSET_VALUE
@@ -569,6 +571,7 @@ module VagrantPlugins
@machine_arch = nil if @machine_arch == UNSET_VALUE
@machine_virtual_size = nil if @machine_virtual_size == UNSET_VALUE
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
@disk_device = 'vda' if @disk_device == UNSET_VALUE
@nic_model_type = 'virtio' if @nic_model_type == UNSET_VALUE
@nested = false if @nested == UNSET_VALUE
@volume_cache = 'default' if @volume_cache == UNSET_VALUE

View File

@@ -74,7 +74,7 @@
<driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
<source file='<%= @domain_volume_path %>'/>
<%# we need to ensure a unique target dev -%>
<target dev='vda' bus='<%= @disk_bus %>'/>
<target dev='<%= @disk_device %>' bus='<%= @disk_bus %>'/>
</disk>
<% end %>
<%# additional disks -%>