summaryrefslogtreecommitdiff
path: root/tests/virfilemock.c
Commit message (Collapse)AuthorAgeFilesLines
* virfile: added GPFS as shared fsDiego Michelotto2019-02-261-0/+5
| | | | | | | | | | | | | Added GPFS as shared file system recognized during live migration security checks. GPFS is 'IBM General Parallel File System' also called 'IBM Spectrum Scale' BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1679528 Signed-off-by: Diego Michelotto <diego.michelotto@cnaf.infn.it> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
* virfile: Detect ceph as shared FSMichal Privoznik2019-01-281-0/+5
| | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1665553 Ceph can be mounted just like any other filesystem and in fact is a shared and cluster filesystem. The filesystem magic constant was taken from kernel sources as it is not in magic.h yet. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
* Remove all Author(s): lines from source file headersDaniel P. Berrangé2018-12-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many files there are header comments that contain an Author: statement, supposedly reflecting who originally wrote the code. In a large collaborative project like libvirt, any non-trivial file will have been modified by a large number of different contributors. IOW, the Author: comments are quickly out of date, omitting people who have made significant contribitions. In some places Author: lines have been added despite the person merely being responsible for creating the file by moving existing code out of another file. IOW, the Author: lines give an incorrect record of authorship. With this all in mind, the comments are useless as a means to identify who to talk to about code in a particular file. Contributors will always be better off using 'git log' and 'git blame' if they need to find the author of a particular bit of code. This commit thus deletes all Author: comments from the source and adds a rule to prevent them reappearing. The Copyright headers are similarly misleading and inaccurate, however, we cannot delete these as they have legal meaning, despite being largely inaccurate. In addition only the copyright holder is permitted to change their respective copyright statement. Reviewed-by: Erik Skultety <eskultet@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* virfile: Take symlink into account in virFileIsSharedFixFUSEMichal Privoznik2018-10-191-1/+32
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1640465 Weirdly enough, there can be symlinks in the path we are trying to fix. If it is the case our clever algorithm that finds matches against mount table won't work. Canonicalize path at the beginning then. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
* virfiletst: Test virFileIsSharedFSMichal Privoznik2018-10-101-0/+154
Introduce some basic test cases for virFileIsSharedFS(). More will be added later. In order to achieve desired result, mocks for setmntent() and statfs() need to be invented because the first thing that virFileIsSharedFS() does is calling the latter. If it finds a FUSE mount it'll call the former. The mock might look a bit complicated, but in fact it's quite simple. The test sets LIBVIRT_MTAB env variable to hold the absolute path to a file containing mount table. Then, statfs() returns matching FS it finds, and setmntent() is there just to replace /proc/mounts with the file the test wants to load. Adding this test also exposed a bug we have - because we assume the given path points to a file we cut off what we assume is a file name to obtain directory path and only then we call statfs(). This is buggy because the passed path could be already a mount point. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>