mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Checking if a volume exists before attempting to create it results in a "time of check to time of use" race. When the check is done the volume doesn't exist but then, because it is shared storage, it is then created by another node before the local attempt to create it. This results in an unexpected failure. It is better to simply attempt to create the volume and ignore EEXIST in cases where this is permissible. Implementing this properly is complicated by the fact that the exception appears to contain only an error message and does not appear to contain a useful error code. Digging through the layers in, for example, fog-libvirt provides no evidence why this is so. However, the error message seems fairly unique and matching it is easy, so just do that. A small hack to vastly improve stability. Signed-off-by: Martin Schwenke <martin@meltin.net>