render / rpms / libvirt

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