mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Volume driver cache parameter
This commit is contained in:
parent
eba55990c4
commit
5d3ea31191
@ -103,6 +103,7 @@ This provider exposes quite a few provider-specific configuration options:
|
|||||||
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
||||||
* `cpus` - Number of virtual cpus. Defaults to 1 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.
|
* `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
|
||||||
|
* `volume_cache` - cache attribute controls the cache mechanism, possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
|
||||||
|
|
||||||
Specific domain settings can be set for each domain separately in multi-VM
|
Specific domain settings can be set for each domain separately in multi-VM
|
||||||
environment. Example below shows a part of Vagrantfile, where specific options
|
environment. Example below shows a part of Vagrantfile, where specific options
|
||||||
@ -116,6 +117,7 @@ Vagrant.configure("2") do |config|
|
|||||||
domain.memory = 2048
|
domain.memory = 2048
|
||||||
domain.cpus = 2
|
domain.cpus = 2
|
||||||
domain.nested = true
|
domain.nested = true
|
||||||
|
domain.volume_cache = 'none'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ module VagrantPlugins
|
|||||||
@cpus = config.cpus
|
@cpus = config.cpus
|
||||||
@nested = config.nested
|
@nested = config.nested
|
||||||
@memory_size = config.memory*1024
|
@memory_size = config.memory*1024
|
||||||
|
@domain_volume_cache = config.volume_cache
|
||||||
|
|
||||||
# TODO get type from driver config option
|
# TODO get type from driver config option
|
||||||
@domain_type = 'kvm'
|
@domain_type = 'kvm'
|
||||||
@ -42,6 +43,7 @@ module VagrantPlugins
|
|||||||
env[:ui].info(" -- Base box: #{env[:machine].box.name}")
|
env[:ui].info(" -- Base box: #{env[:machine].box.name}")
|
||||||
env[:ui].info(" -- Storage pool: #{env[:machine].provider_config.storage_pool_name}")
|
env[:ui].info(" -- Storage pool: #{env[:machine].provider_config.storage_pool_name}")
|
||||||
env[:ui].info(" -- Image: #{@domain_volume_path}")
|
env[:ui].info(" -- Image: #{@domain_volume_path}")
|
||||||
|
env[:ui].info(" -- Volume Cache: #{@domain_volume_cache}")
|
||||||
|
|
||||||
# Create libvirt domain.
|
# Create libvirt domain.
|
||||||
# Is there a way to tell fog to create new domain with already
|
# Is there a way to tell fog to create new domain with already
|
||||||
|
@ -39,6 +39,7 @@ module VagrantPlugins
|
|||||||
@memory = UNSET_VALUE
|
@memory = UNSET_VALUE
|
||||||
@cpus = UNSET_VALUE
|
@cpus = UNSET_VALUE
|
||||||
@nested = UNSET_VALUE
|
@nested = UNSET_VALUE
|
||||||
|
@volume_cache = UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
@ -53,6 +54,7 @@ module VagrantPlugins
|
|||||||
@memory = 512 if @memory == UNSET_VALUE
|
@memory = 512 if @memory == UNSET_VALUE
|
||||||
@cpus = 1 if @cpus == UNSET_VALUE
|
@cpus = 1 if @cpus == UNSET_VALUE
|
||||||
@nested = false if @nested == UNSET_VALUE
|
@nested = false if @nested == UNSET_VALUE
|
||||||
|
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(machine)
|
def validate(machine)
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
<devices>
|
<devices>
|
||||||
<disk type='file' device='disk'>
|
<disk type='file' device='disk'>
|
||||||
<driver name='qemu' type='qcow2'/>
|
<driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
|
||||||
<source file='<%= @domain_volume_path %>'/>
|
<source file='<%= @domain_volume_path %>'/>
|
||||||
<%# we need to ensure a unique target dev -%>
|
<%# we need to ensure a unique target dev -%>
|
||||||
<target dev='vda' bus='virtio'/>
|
<target dev='vda' bus='virtio'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user