]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: fs: Ignore volumes that fail to open with EACCESS/EPERM
authorCole Robinson <crobinso@redhat.com>
Mon, 27 Apr 2015 15:47:28 +0000 (11:47 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 13:48:36 +0000 (09:48 -0400)
Trying to use qemu:///session to create a storage pool pointing at
/tmp will usually fail with something like:

$ virsh pool-start tmp
error: Failed to start pool tmp
error: cannot open volume '/tmp/systemd-private-c38cf0418d7a4734a66a8175996c384f-colord.service-kEyiTA': Permission denied

If any volume in an FS pool can't be opened by the daemon, the refresh
fails, and the pool can't be used.

This causes pain for virt-install/virt-manager though. Imaging a user
downloads a disk image to /tmp. virt-manager wants to import /tmp as
a storage pool, so we can detect what disk format it is, and set the
XML correctly. However this case will likely fail as explained above.

Change the logic here to skip volumes that fail to open. This could
conceivably cause user complaints along the lines of 'why doesn't
libvirt show $ROOT-OWNED-VOLUME-FOO', but figuring that currently
the pool won't even startup, I don't think there are any current
users that care about that case.

https://bugzilla.redhat.com/show_bug.cgi?id=1103308
(cherry picked from commit 56476f6a2d1564c040b749a385c3588a914921f0)

src/storage/storage_backend.c

index a67d50cb3385cb788eebc3fdceb4078b40a1a527..204655571c731c52e5076164d7deee1025123a82 100644 (file)
@@ -1442,6 +1442,10 @@ virStorageBackendVolOpen(const char *path, struct stat *sb,
             VIR_WARN("ignoring missing fifo '%s'", path);
             return -2;
         }
+        if ((errno == EACCES || errno == EPERM) && noerror) {
+            VIR_WARN("ignoring permission error for '%s'", path);
+            return -2;
+        }
 
         virReportSystemError(errno, _("cannot open volume '%s'"), path);
         return -1;