[PATCH 1/1] virfile: added GPFS as shared fs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added GPFS as shared file system recognized during live migration
security checks.

This patch is based on libvirt-4.5.0 distributed by CentOS 7.6.1810
via source rpm.

The rpms builded fix our bug with GPFS.

BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1679528
---
 src/util/virfile.c            | 9 ++++++++-
 src/util/virfile.h            | 1 +
 tests/virfiledata/mounts3.txt | 1 +
 tests/virfilemock.c           | 5 +++++
 tests/virfiletest.c           | 1 +
 5 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 716b55d..59bf619 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3537,6 +3537,9 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
 # ifndef FUSE_SUPER_MAGIC
 #  define FUSE_SUPER_MAGIC 0x65735546
 # endif
+# ifndef GPFS_SUPER_MAGIC
+#  define GPFS_SUPER_MAGIC 0x47504653
+# endif
 
 # define PROC_MOUNTS "/proc/mounts"
 
@@ -3682,6 +3685,9 @@ virFileIsSharedFSType(const char *path,
     if ((fstypes & VIR_FILE_SHFS_CIFS) &&
         (f_type == CIFS_SUPER_MAGIC))
         return 1;
+    if ((fstypes & VIR_FILE_SHFS_GPFS) &&
+        (f_type == GPFS_SUPER_MAGIC))
+        return 1;
 
     return 0;
 }
@@ -3845,7 +3851,8 @@ int virFileIsSharedFS(const char *path)
                                  VIR_FILE_SHFS_OCFS |
                                  VIR_FILE_SHFS_AFS |
                                  VIR_FILE_SHFS_SMB |
-                                 VIR_FILE_SHFS_CIFS);
+                                 VIR_FILE_SHFS_CIFS |
+                                 VIR_FILE_SHFS_GPFS);
 }
 
 
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 6f1e802..a26be1e 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -205,6 +205,7 @@ enum {
     VIR_FILE_SHFS_AFS = (1 << 3),
     VIR_FILE_SHFS_SMB = (1 << 4),
     VIR_FILE_SHFS_CIFS = (1 << 5),
+    VIR_FILE_SHFS_GPFS = (1 << 7),
 };
 
 int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
diff --git a/tests/virfiledata/mounts3.txt b/tests/virfiledata/mounts3.txt
index 134c6e8..a6cea9d 100644
--- a/tests/virfiledata/mounts3.txt
+++ b/tests/virfiledata/mounts3.txt
@@ -33,3 +33,4 @@ host:/nfs /nfs nfs4 rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,
 dev /nfs/blah devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=4093060,mode=755 0 0
 host:/gv0 /gluster fuse.glusterfs rw 0 0
 root@host:/tmp/mkdir /gluster/sshfs fuse.sshfs rw 0 0
+gpfs_data /gpfs/data gpfs rw,relatime 0 0
diff --git a/tests/virfilemock.c b/tests/virfilemock.c
index ae5c8d0..bf721cf 100644
--- a/tests/virfilemock.c
+++ b/tests/virfilemock.c
@@ -88,6 +88,9 @@ setmntent(const char *filename, const char *type)
 #ifndef FUSE_SUPER_MAGIC
 # define FUSE_SUPER_MAGIC 0x65735546
 #endif
+#ifndef GPFS_SUPER_MAGIC
+# define GPFS_SUPER_MAGIC 0x47504653
+#endif
 
 
 static int
@@ -134,6 +137,8 @@ statfs_mock(const char *mtab,
             ftype = CIFS_SUPER_MAGIC;
         } else if (STRPREFIX(mb.mnt_type, "fuse")) {
             ftype = FUSE_SUPER_MAGIC;
+        } else if (STRPREFIX(mb.mnt_type, "gpfs")) {
+            ftype = GPFS_SUPER_MAGIC;
         } else {
             /* Everything else is EXT4. We don't care really for other paths. */
             ftype = EXT4_SUPER_MAGIC;
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
index a246d60..9d9ab2f 100644
--- a/tests/virfiletest.c
+++ b/tests/virfiletest.c
@@ -458,6 +458,7 @@ mymain(void)
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/gluster/file", true);
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/gluster/sshfs/file", false);
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/some/symlink/file", true);
+    DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/gpfs/data", true);
 
     return ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux