Merge pull request #118 from sciurus/configurable_disk_bus

Allow changing disk bus
This commit is contained in:
Dmitry Vasilets 2014-01-06 13:09:06 -08:00
commit 9d6f6238bc
4 changed files with 7 additions and 2 deletions

View File

@ -103,6 +103,7 @@ This provider exposes quite a few provider-specific configuration options:
### Domain Specific Options
* `disk_bus` - The type of disk device to emulate. Defaults to virtio if not set. Possible values are documented in libvirt's [description for _target_](http://libvirt.org/formatdomain.html#elementsDisks).
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
* `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.
@ -121,7 +122,7 @@ Vagrant.configure("2") do |config|
domain.memory = 2048
domain.cpus = 2
domain.nested = true
domain.volume_cache = 'none'
domain.volume_cache = 'none'
end
end

View File

@ -20,6 +20,7 @@ module VagrantPlugins
@name = env[:domain_name]
@cpus = config.cpus
@cpu_mode = config.cpu_mode
@disk_bus = config.disk_bus
@nested = config.nested
@memory_size = config.memory*1024
@domain_volume_cache = config.volume_cache

View File

@ -32,6 +32,7 @@ module VagrantPlugins
attr_accessor :memory
attr_accessor :cpus
attr_accessor :cpu_mode
attr_accessor :disk_bus
attr_accessor :nested
attr_accessor :volume_cache
@ -49,6 +50,7 @@ module VagrantPlugins
@memory = UNSET_VALUE
@cpus = UNSET_VALUE
@cpu_mode = UNSET_VALUE
@disk_bus = UNSET_VALUE
@nested = UNSET_VALUE
@volume_cache = UNSET_VALUE
end
@ -67,6 +69,7 @@ module VagrantPlugins
@memory = 512 if @memory == UNSET_VALUE
@cpus = 1 if @cpus == UNSET_VALUE
@cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE
@disk_bus = 'virtio' if @disk_bus == UNSET_VALUE
@nested = false if @nested == UNSET_VALUE
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
end

View File

@ -26,7 +26,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='virtio'/>
<target dev='vda' bus='<%= @disk_bus %>'/>
</disk>
<serial type='pty'>
<target port='0'/>