0a7476
From 92bca785f753f6bc80e2ebe612363a351f56e3d9 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <92bca785f753f6bc80e2ebe612363a351f56e3d9@dist-git>
e53605
From: Diego Michelotto <diego.michelotto@cnaf.infn.it>
0a7476
Date: Tue, 21 May 2019 16:35:08 +0200
e53605
Subject: [PATCH] virfile: added GPFS as shared fs
e53605
MIME-Version: 1.0
e53605
Content-Type: text/plain; charset=UTF-8
e53605
Content-Transfer-Encoding: 8bit
e53605
e53605
Added GPFS as shared file system recognized during live migration
e53605
security checks.
e53605
e53605
GPFS is 'IBM General Parallel File System' also called
e53605
'IBM Spectrum Scale'
e53605
e53605
BUG: https://bugzilla.redhat.com/show_bug.cgi?id=1679528
e53605
e53605
Signed-off-by: Diego Michelotto <diego.michelotto@cnaf.infn.it>
e53605
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
e53605
(cherry picked from commit d163b940a73a0d6b8277a4bccef2b60936933cf0)
0a7476
https: //bugzilla.redhat.com/show_bug.cgi?id=1710728 [rhel-7.7]
0a7476
Message-Id: <635dc075347096db1132d6d519aa8a5b1baca6aa.1558449212.git.pkrempa@redhat.com>
e53605
Reviewed-by: Ján Tomko <jtomko@redhat.com>
e53605
---
e53605
 src/util/virfile.c            | 9 ++++++++-
e53605
 src/util/virfile.h            | 1 +
e53605
 tests/virfiledata/mounts3.txt | 1 +
e53605
 tests/virfilemock.c           | 5 +++++
e53605
 tests/virfiletest.c           | 1 +
e53605
 5 files changed, 16 insertions(+), 1 deletion(-)
e53605
e53605
diff --git a/src/util/virfile.c b/src/util/virfile.c
e53605
index 471d309062..e0564295dd 100644
e53605
--- a/src/util/virfile.c
e53605
+++ b/src/util/virfile.c
e53605
@@ -3540,6 +3540,9 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
e53605
 # ifndef CEPH_SUPER_MAGIC
e53605
 #  define CEPH_SUPER_MAGIC 0x00C36400
e53605
 # endif
e53605
+# ifndef GPFS_SUPER_MAGIC
e53605
+#  define GPFS_SUPER_MAGIC 0x47504653
e53605
+# endif
e53605
 
e53605
 # define PROC_MOUNTS "/proc/mounts"
e53605
 
e53605
@@ -3688,6 +3691,9 @@ virFileIsSharedFSType(const char *path,
e53605
     if ((fstypes & VIR_FILE_SHFS_CEPH) &&
e53605
         (f_type == CEPH_SUPER_MAGIC))
e53605
         return 1;
e53605
+    if ((fstypes & VIR_FILE_SHFS_GPFS) &&
e53605
+        (f_type == GPFS_SUPER_MAGIC))
e53605
+        return 1;
e53605
 
e53605
     return 0;
e53605
 }
e53605
@@ -3852,7 +3858,8 @@ int virFileIsSharedFS(const char *path)
e53605
                                  VIR_FILE_SHFS_AFS |
e53605
                                  VIR_FILE_SHFS_SMB |
e53605
                                  VIR_FILE_SHFS_CIFS |
e53605
-                                 VIR_FILE_SHFS_CEPH);
e53605
+                                 VIR_FILE_SHFS_CEPH |
e53605
+                                 VIR_FILE_SHFS_GPFS);
e53605
 }
e53605
 
e53605
 
e53605
diff --git a/src/util/virfile.h b/src/util/virfile.h
e53605
index 1d16e96b59..51c221e069 100644
e53605
--- a/src/util/virfile.h
e53605
+++ b/src/util/virfile.h
e53605
@@ -206,6 +206,7 @@ enum {
e53605
     VIR_FILE_SHFS_SMB = (1 << 4),
e53605
     VIR_FILE_SHFS_CIFS = (1 << 5),
e53605
     VIR_FILE_SHFS_CEPH = (1 << 6),
e53605
+    VIR_FILE_SHFS_GPFS = (1 << 7),
e53605
 };
e53605
 
e53605
 int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
e53605
diff --git a/tests/virfiledata/mounts3.txt b/tests/virfiledata/mounts3.txt
e53605
index 68eded048c..4377e5d471 100644
e53605
--- a/tests/virfiledata/mounts3.txt
e53605
+++ b/tests/virfiledata/mounts3.txt
e53605
@@ -35,3 +35,4 @@ host:/gv0 /gluster fuse.glusterfs rw 0 0
e53605
 root@host:/tmp/mkdir /gluster/sshfs fuse.sshfs rw 0 0
e53605
 192.168.0.1:/ceph/data /ceph ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
e53605
 192.168.0.1,192.168.0.2,192.168.0.3:/ceph/data2 /ceph/multi ceph rw,noatime,name=cephfs,secret=<hidden>,acl,wsize=16777216 0 0
e53605
+gpfs_data /gpfs/data gpfs rw,relatime 0 0
e53605
diff --git a/tests/virfilemock.c b/tests/virfilemock.c
e53605
index eb5182df66..02f26433d4 100644
e53605
--- a/tests/virfilemock.c
e53605
+++ b/tests/virfilemock.c
e53605
@@ -91,6 +91,9 @@ setmntent(const char *filename, const char *type)
e53605
 #ifndef CEPH_SUPER_MAGIC
e53605
 # define CEPH_SUPER_MAGIC 0x00c36400
e53605
 #endif
e53605
+#ifndef GPFS_SUPER_MAGIC
e53605
+# define GPFS_SUPER_MAGIC 0x47504653
e53605
+#endif
e53605
 
e53605
 
e53605
 static int
e53605
@@ -139,6 +142,8 @@ statfs_mock(const char *mtab,
e53605
             ftype = FUSE_SUPER_MAGIC;
e53605
         } else if (STRPREFIX(mb.mnt_type, "ceph")) {
e53605
             ftype = CEPH_SUPER_MAGIC;
e53605
+        } else if (STRPREFIX(mb.mnt_type, "gpfs")) {
e53605
+            ftype = GPFS_SUPER_MAGIC;
e53605
         } else {
e53605
             /* Everything else is EXT4. We don't care really for other paths. */
e53605
             ftype = EXT4_SUPER_MAGIC;
e53605
diff --git a/tests/virfiletest.c b/tests/virfiletest.c
e53605
index 972c07fdc5..5f17676c75 100644
e53605
--- a/tests/virfiletest.c
e53605
+++ b/tests/virfiletest.c
e53605
@@ -460,6 +460,7 @@ mymain(void)
e53605
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/some/symlink/file", true);
e53605
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/ceph/file", true);
e53605
     DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/ceph/multi/file", true);
e53605
+    DO_TEST_FILE_IS_SHARED_FS_TYPE("mounts3.txt", "/gpfs/data", true);
e53605
 
e53605
     return ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
e53605
 }
e53605
-- 
e53605
2.21.0
e53605