mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
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.
This commit is contained in:
parent
9885e58c21
commit
1ed088924a
@ -151,9 +151,11 @@ module VagrantPlugins
|
|||||||
rescue Libvirt::Error => e
|
rescue Libvirt::Error => e
|
||||||
# It is hard to believe that e contains just a string
|
# It is hard to believe that e contains just a string
|
||||||
# and no useful error code!
|
# and no useful error code!
|
||||||
msg = "Call to virStorageVolCreateXML failed: " +
|
msgs = [disk[:name], disk[:absolute_path]].map do |name|
|
||||||
"storage volume '#{disk[:absolute_path]}' exists already"
|
"Call to virStorageVolCreateXML failed: " +
|
||||||
if e.message == msg and disk[:allow_existing]
|
"storage volume '#{name}' exists already"
|
||||||
|
end
|
||||||
|
if msgs.include?(e.message) and disk[:allow_existing]
|
||||||
disk[:preexisting] = true
|
disk[:preexisting] = true
|
||||||
else
|
else
|
||||||
raise Errors::FogCreateDomainVolumeError,
|
raise Errors::FogCreateDomainVolumeError,
|
||||||
|
Loading…
Reference in New Issue
Block a user