diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index b1421ecf5f..e759ad62d3 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1212,6 +1212,10 @@ virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, char *base = last_component(path); if (lstat(path, sb) < 0) { + if (errno == ENOENT && !(flags & VIR_STORAGE_VOL_OPEN_ERROR)) { + VIR_WARN("ignoring missing file '%s'", path); + return -2; + } virReportSystemError(errno, _("cannot stat file '%s'"), path); @@ -1238,6 +1242,10 @@ virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb, VIR_WARN("ignoring dangling symlink '%s'", path); return -2; } + if (errno == ENOENT && !(flags & VIR_STORAGE_VOL_OPEN_ERROR)) { + VIR_WARN("ignoring missing file '%s'", path); + return -2; + } virReportSystemError(errno, _("cannot open volume '%s'"),