render / rpms / libvirt

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