From c55119641183e4ee91d364580ace0e8ad8168c2d Mon Sep 17 00:00:00 2001 From: dima Date: Thu, 14 May 2015 10:06:55 +0200 Subject: [PATCH] fix for custom path --- lib/vagrant-libvirt/action/destroy_domain.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/action/destroy_domain.rb b/lib/vagrant-libvirt/action/destroy_domain.rb index 9948ab6..6d13d6a 100644 --- a/lib/vagrant-libvirt/action/destroy_domain.rb +++ b/lib/vagrant-libvirt/action/destroy_domain.rb @@ -44,7 +44,16 @@ module VagrantPlugins libvirt_disk = env[:libvirt_compute].volumes.all.select do |x| x.name == diskname end.first - libvirt_disk.destroy if libvirt_disk + if libvirt_disk + libvirt_disk.destroy + elsif disk[:path] + poolname = env[:machine].provider_config.storage_pool_name + libvirt_disk = env[:libvirt_compute].volumes.all.select do |x| + # FIXME can remove pool/target.img and pool/123/target.img + x.path =~ /\/#{disk[:path]}$/ && x.pool_name == poolname + end.first + libvirt_disk.destroy if libvirt_disk + end end # remove root storage