Files
vagrant-libvirt/lib
Martin Schwenke 222b50925d Avoid TOCTOU error in volume creation
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>
2019-03-13 21:50:13 +11:00
..
2017-01-16 16:40:23 +01:00