]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: Change virStorageBackendVolOpen to use virFileOpenAs
authorJohn Ferlan <jferlan@redhat.com>
Tue, 17 Nov 2015 15:13:43 +0000 (10:13 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 20 Nov 2015 22:07:13 +0000 (17:07 -0500)
commit5e3ad0b77598063ff041018c895aa1c3d86bee07
tree61b879cc2a561a801ebd01bd95aa366c1a982f33
parentce6506b0bc93012f872c860649835f870ba7e278
storage: Change virStorageBackendVolOpen to use virFileOpenAs

https://bugzilla.redhat.com/show_bug.cgi?id=1282288

Rather than using just open on the path, allow for the possibility that
the path to be opened resides on an NFS root-squash target and was created
under a different uid/gid.

Without using virFileOpenAs an attempt to get the volume size data may fail
if the current user doesn't have permissions to read the volume, such as
would be the case if mode wasn't supplied in the volume XML and the default
VIR_STORAGE_DEFAULT_VOL_PERM_MODE (e.g. 0600) was used. Under this scenario
the owner/group is not root:root, thus this path run under root would fail
to open/read the volume.

NB: The virFileOpenAs code using OPEN_FORK will only work when the failure
is not EACESS/EPERM and the path resolves to a shared file system.
src/storage/storage_backend.c