mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Add disk driver options with minor refactor (#1000)
Adds disk driver options: io, copy_on_read, discard and detect_zeroes for both the primary vm disk and additional disks. Minor refactor of existing volume_cache to deprecate and replace with a single call to disk_driver that contains all of the options. Usage of the volume_cache option will now result in a message to ui that it has been replaced, as well as a warning that it is ignored if disk_driveris set. The old option volume_cache is only used if disk_driver is not present (even if :cache is not set - in that case, the hypervisor default is always used). Resolves #998
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/kvm-spice</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2' cache='unsafe'/>
|
||||
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
|
||||
<source file='/var/lib/libvirt/images/test.qcow2'/>
|
||||
<target dev='vda' bus='ide'/>
|
||||
</disk>
|
||||
@@ -53,7 +53,7 @@
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2' cache='default'/>
|
||||
<driver name='qemu' type='qcow2' cache='default' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
|
||||
<source file='/var/lib/libvirt/images/test-disk2.qcow2'/>
|
||||
<target dev='vdc' bus='virtio'/>
|
||||
</disk>
|
||||
|
||||
@@ -45,11 +45,12 @@ describe 'templates/domain' do
|
||||
domain.boot('hd')
|
||||
domain.emulator_path = '/usr/bin/kvm-spice'
|
||||
domain.instance_variable_set('@domain_volume_path', '/var/lib/libvirt/images/test.qcow2')
|
||||
domain.instance_variable_set('@domain_volume_cache', 'unsafe')
|
||||
domain.instance_variable_set('@domain_volume_cache', 'deprecated')
|
||||
domain.disk_bus = 'ide'
|
||||
domain.disk_device = 'vda'
|
||||
domain.disk_driver(:cache => 'unsafe', :io => 'threads', :copy_on_read => 'on', :discard => 'unmap', :detect_zeroes => 'on')
|
||||
domain.storage(:file, path: 'test-disk1.qcow2')
|
||||
domain.storage(:file, path: 'test-disk2.qcow2')
|
||||
domain.storage(:file, path: 'test-disk2.qcow2', io: 'threads', copy_on_read: 'on', discard: 'unmap', detect_zeroes: 'on')
|
||||
domain.disks.each do |disk|
|
||||
disk[:absolute_path] = '/var/lib/libvirt/images/' + disk[:path]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user