render / rpms / libvirt

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