From 7b38af568c09eeb323a5f6aec26e6addd34d4810 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 26 Oct 2014 23:47:50 +0000 Subject: [PATCH] allow cache mode to be set for additional disks --- README.md | 1 + lib/vagrant-libvirt/config.rb | 1 + lib/vagrant-libvirt/templates/domain.xml.erb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 83c7fac..5d311f0 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,7 @@ You can create and attach additional disks to a VM via `libvirt.storage :file`. * `device` - Name of the device node the disk image will have in the VM, e.g. *vdb*. If unspecified, the next available device is chosen. * `size` - Size of the disk image. If unspecified, defaults to 10G. * `type` - Type of disk image to create. Defaults to *qcow2*. +* `cache` - Cache mode to use, e.g. `none`, `writeback`, `writethrough` (see the [libvirt documentation for possible values](http://libvirt.org/formatdomain.html#elementsDisks) or [here](https://www.suse.com/documentation/sles11/book_kvm/data/sect1_chapter_book_kvm.html) for a fuller explanation). Defaults to *default*. The following example creates two additional disks. diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 5ccf2de..019d083 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb @@ -141,6 +141,7 @@ module VagrantPlugins :type => options[:type], :size => options[:size], :path => options[:path], + :cache => options[:cache] || 'default', } if storage_type == :file diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb index d5e0486..194f21a 100644 --- a/lib/vagrant-libvirt/templates/domain.xml.erb +++ b/lib/vagrant-libvirt/templates/domain.xml.erb @@ -36,7 +36,7 @@ <%# additional disks -%> <% @disks.each do |d| -%> - + <%# this will get auto generated by libvirt