From e693b017dd443135ae031c119cc3c998cad74187 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sat, 25 Oct 2014 14:35:31 +0100 Subject: [PATCH 1/3] don't monkey-patch #default_provider This monkey-patching of Vagrant::Environment#default_provider breaks with Vagrant 1.7.0, since the method's signature changed. In any case Vagrant should do the right thing without "help" from vagrant-libvirt. --- lib/vagrant-libvirt.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/vagrant-libvirt.rb b/lib/vagrant-libvirt.rb index c7204d9..825e5fa 100644 --- a/lib/vagrant-libvirt.rb +++ b/lib/vagrant-libvirt.rb @@ -27,13 +27,3 @@ module VagrantPlugins end end end - -# set provider by bash env -# export VAGRANT_DEFAULT_PROVIDER=libvirt -Vagrant::Environment.class_eval do - def default_provider - (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym - end -end - - From 773a4f48d6dc141ee7d71218f3198351685f36f7 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 21 Oct 2014 00:39:40 +0100 Subject: [PATCH 2/3] allow newer ruby-libvirt (#158) As per #158, vagrant-libvirt depends on ruby-libvirt transitively through fog. Since fog/fog#2706 was resolved, fog now requires ruby-libvirt ~> 0.5.0, therefore vagrant-libvirt should allow both 0.4.x and 0.5.x. Furthermore, according to semantic versioning, we currently have no good reason to reject anything newer below 1.x. If such a restriction is required in the future (e.g. < 0.7.0) then it is likely that fog's .gemspec will take care of that on our behalf anyway. Closes #158. --- vagrant-libvirt.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant-libvirt.gemspec b/vagrant-libvirt.gemspec index 8c19f9c..e72b53b 100644 --- a/vagrant-libvirt.gemspec +++ b/vagrant-libvirt.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency "rspec-mocks", "~> 2.12.1" gem.add_runtime_dependency 'fog', '~> 1.15' - gem.add_runtime_dependency 'ruby-libvirt', '~> 0.4.0' + gem.add_runtime_dependency 'ruby-libvirt', '~> 0.4' gem.add_runtime_dependency 'nokogiri', '~> 1.6.0' gem.add_development_dependency 'rake' From 7b38af568c09eeb323a5f6aec26e6addd34d4810 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 26 Oct 2014 23:47:50 +0000 Subject: [PATCH 3/3] 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