]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuDomainGetPreservedMounts: Fix suffixes for corner cases
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 12 Jun 2017 14:44:45 +0000 (16:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 16 Jun 2017 12:38:49 +0000 (14:38 +0200)
commit6451b55ec3d801bb03e912b0811408cf82cfc880
treeb0d01eab444279c01e0ad2105c687108fe58791d
parentcdd9205dfffa3aaed935446a41f0d2dd1357c268
qemuDomainGetPreservedMounts: Fix suffixes for corner cases

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

Imagine a FS mounted on /dev/blah/blah2. Our process of creating
suffix for temporary location where all the mounted filesystems
are moved is very simplistic. We want:

/var/run/libvirt/qemu/$domName.$suffix\

were $suffix is just the mount point path stripped of the "/dev/"
prefix. For instance:

/var/run/libvirt/qemu/fedora.mqueue  for /dev/mqueue
/var/run/libvirt/qemu/fedora.pts     for /dev/pts

and so on. Now if we plug /dev/blah/blah2 into the example we see
some misbehaviour:

/var/run/libvirt/qemu/fedora.blah/blah2

Well, misbehaviour if /dev/blah/blah2 is a file, because in that
case we call virFileTouch() instead of virFileMakePath().
The solution is to replace all the slashes in the suffix with say
dots. That way we don't have to care about nested directories.
IOW, the result we want for given example is:

/var/run/libvirt/qemu/fedora.blah.blah2

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c