Open jvoisin opened 2 years ago
mhm weird, it seems the important part is
Error while creating volume for domain: Call to virStorageVolCreateXML failed: storage volume 'apt-cacher-ng-data.qcow2' exists already
The volume is setup in vagrant/Vagrantfile
and has allow_existing
set to true
:
if ENV['TAILS_PROXY_TYPE'] == 'vmproxy'
domain.storage(
:file, size: '15G', allow_existing: true,
path: 'apt-cacher-ng-data.qcow2'
)
end
It seems this is a recent regression in vagrant-libvirt
, apparently allow_existing
works by matching error messages. The anonymous reporter of the issue attached this patch:
From 1ed088924a1560375c353f91f79f4c1cd02de92d Mon Sep 17 00:00:00 2001
From: anonym <anonym@riseup.net>
Date: Wed, 8 Jun 2022 18:21:35 +0000
Subject: [PATCH] Fix allow_existing for disks against newer versions of
libvirt. (#1507)
When running vagrant-libvirt on an up-to-date Debian unstable with
libvirt 8.4.0 the expected error message doesn't contain the full
path any more.
---
lib/vagrant-libvirt/action/create_domain.rb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb
index 7899424..9da82d3 100644
--- a/lib/vagrant-libvirt/action/create_domain.rb
+++ b/lib/vagrant-libvirt/action/create_domain.rb
@@ -151,9 +151,11 @@ module VagrantPlugins
rescue Libvirt::Error => e
# It is hard to believe that e contains just a string
# and no useful error code!
- msg = "Call to virStorageVolCreateXML failed: " +
- "storage volume '#{disk[:absolute_path]}' exists already"
- if e.message == msg and disk[:allow_existing]
+ msgs = [disk[:name], disk[:absolute_path]].map do |name|
+ "Call to virStorageVolCreateXML failed: " +
+ "storage volume '#{name}' exists already"
+ end
+ if msgs.include?(e.message) and disk[:allow_existing]
disk[:preexisting] = true
else
raise Errors::FogCreateDomainVolumeError,
--
2.36.1