fstests: add GlusterFS support
authorZorro Lang <zlang@redhat.com>
Thu, 16 Mar 2017 05:28:19 +0000 (13:28 +0800)
committerEryu Guan <eguan@redhat.com>
Fri, 17 Mar 2017 04:24:01 +0000 (12:24 +0800)
Add basic GlusterFS support. Neither new GlusterFS specific tests
nor related patches are included. Only support FSTYP=glusterfs or
check -glusterfs XXX.

To test on glusterfs, two gluster volumes and two mountpoint
directories are needed.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
README.config-sections
check
common/config
common/rc

index df7c9292b747d4c0c1142f0c99ad91f6d6682e7b..8c319ba9777893ff87f258619c947ae83514618b 100644 (file)
@@ -121,3 +121,10 @@ TEST_DIR=/mnt/test
 TEST_DEV=192.168.14.1:6789:/
 TEST_FS_MOUNT_OPTS="-o name=admin,secret=AQDuEBtYKEYRINGSECRETriSC8YJGDZsQHcr7g=="
 FSTYP="ceph"
 TEST_DEV=192.168.14.1:6789:/
 TEST_FS_MOUNT_OPTS="-o name=admin,secret=AQDuEBtYKEYRINGSECRETriSC8YJGDZsQHcr7g=="
 FSTYP="ceph"
+
+[glusterfs]
+FSTYP=glusterfs
+TEST_DIR=/mnt/gluster/test
+TEST_DEV=192.168.1.1:testvol
+SCRATCH_MNT=/mnt/gluster/scratch
+SCRATCH_DEV=192.168.1.1:scratchvol
diff --git a/check b/check
index c2c22e2386213324eecfeeb13a6507070f18981c..2fcf385f90f2daa034aa19d4a766144c1ac9825e 100755 (executable)
--- a/check
+++ b/check
@@ -65,6 +65,7 @@ usage()
 
 check options
     -nfs                test NFS
 
 check options
     -nfs                test NFS
+    -glusterfs                test GlusterFS
     -cifs               test CIFS
     -overlay           test overlay
     -tmpfs              test TMPFS
     -cifs               test CIFS
     -overlay           test overlay
     -tmpfs              test TMPFS
@@ -260,6 +261,7 @@ while [ $# -gt 0 ]; do
        -\? | -h | --help) usage ;;
 
        -nfs)           FSTYP=nfs ;;
        -\? | -h | --help) usage ;;
 
        -nfs)           FSTYP=nfs ;;
+       -glusterfs)     FSTYP=glusterfs ;;
        -cifs)          FSTYP=cifs ;;
        -overlay)       FSTYP=overlay; export OVERLAY=true ;;
        -tmpfs)         FSTYP=tmpfs ;;
        -cifs)          FSTYP=cifs ;;
        -overlay)       FSTYP=overlay; export OVERLAY=true ;;
        -tmpfs)         FSTYP=tmpfs ;;
index 121f9df143f64c59ad7f15fe5dbaaf1dfd4fb320..59041a39d939183a9b8f7e88f5ab8e24c10ee6f6 100644 (file)
@@ -307,6 +307,9 @@ _mount_opts()
        ceph)
                export MOUNT_OPTIONS=$CEPHFS_MOUNT_OPTIONS
                ;;
        ceph)
                export MOUNT_OPTIONS=$CEPHFS_MOUNT_OPTIONS
                ;;
+       glusterfs)
+               export MOUNT_OPTIONS=$GLUSTERFS_MOUNT_OPTIONS
+               ;;
        overlay)
                export MOUNT_OPTIONS=$OVERLAY_MOUNT_OPTIONS
                ;;
        overlay)
                export MOUNT_OPTIONS=$OVERLAY_MOUNT_OPTIONS
                ;;
@@ -350,6 +353,9 @@ _test_mount_opts()
        nfs)
                export TEST_FS_MOUNT_OPTS=$NFS_MOUNT_OPTIONS
                ;;
        nfs)
                export TEST_FS_MOUNT_OPTS=$NFS_MOUNT_OPTIONS
                ;;
+       glusterfs)
+               export TEST_FS_MOUNT_OPTS=$GLUSTERFS_MOUNT_OPTIONS
+               ;;
        *)
                ;;
        esac
        *)
                ;;
        esac
index d7a53215bd2718bee03544362f68d000999ca799..edfba5d2535d4aae3454a9e57246f0c2f8a2587b 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -167,6 +167,8 @@ case "$FSTYP" in
         ;;
     ceph)
         ;;
         ;;
     ceph)
         ;;
+    glusterfs)
+        ;;
     overlay)
         ;;
     reiser4)
     overlay)
         ;;
     reiser4)
@@ -706,6 +708,9 @@ _test_mkfs()
     ceph)
        # do nothing for ceph
        ;;
     ceph)
        # do nothing for ceph
        ;;
+    glusterfs)
+       # do nothing for glusterfs
+       ;;
     overlay)
        # do nothing for overlay
        ;;
     overlay)
        # do nothing for overlay
        ;;
@@ -788,7 +793,7 @@ _scratch_mkfs()
        local mkfs_status
 
        case $FSTYP in
        local mkfs_status
 
        case $FSTYP in
-       nfs*|cifs|ceph|overlay)
+       nfs*|cifs|ceph|overlay|glusterfs)
                # unable to re-create this fstyp, just remove all files in
                # $SCRATCH_MNT to avoid EEXIST caused by the leftover files
                # created in previous runs
                # unable to re-create this fstyp, just remove all files in
                # $SCRATCH_MNT to avoid EEXIST caused by the leftover files
                # created in previous runs
@@ -1307,7 +1312,8 @@ _fs_type()
     # Fix the filesystem type up here so that the callers don't
     # have to bother with this quirk.
     #
     # Fix the filesystem type up here so that the callers don't
     # have to bother with this quirk.
     #
-    _df_device $1 | $AWK_PROG '{ print $2 }' | sed -e 's/nfs4/nfs/'
+    _df_device $1 | $AWK_PROG '{ print $2 }' | \
+        sed -e 's/nfs4/nfs/' -e 's/fuse.glusterfs/glusterfs/'
 }
 
 # return the FS mount options of a mounted device
 }
 
 # return the FS mount options of a mounted device
@@ -1489,6 +1495,15 @@ _check_mounted_on()
 _require_scratch_nocheck()
 {
     case "$FSTYP" in
 _require_scratch_nocheck()
 {
     case "$FSTYP" in
+       glusterfs)
+               echo $SCRATCH_DEV | grep -q "\w:\w" > /dev/null 2>&1
+               if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
+                       _notrun "this test requires a valid \$SCRATCH_DEV"
+               fi
+               if [ ! -d "$SCRATCH_MNT" ]; then
+                       _notrun "this test requires a valid \$SCRATCH_MNT"
+               fi
+               ;;
        nfs*|ceph)
                echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
                if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
        nfs*|ceph)
                echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
                if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
@@ -1568,6 +1583,15 @@ _require_scratch()
 _require_test()
 {
     case "$FSTYP" in
 _require_test()
 {
     case "$FSTYP" in
+       glusterfs)
+               echo $TEST_DEV | grep -q "\w:\w" > /dev/null 2>&1
+               if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
+                       _notrun "this test requires a valid \$TEST_DEV"
+               fi
+               if [ ! -d "$TEST_DIR" ]; then
+                       _notrun "this test requires a valid \$TEST_DIR"
+               fi
+               ;;
        nfs*|ceph)
                echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
                if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
        nfs*|ceph)
                echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
                if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
@@ -2421,6 +2445,9 @@ _check_test_fs()
     ceph)
        # no way to check consistency for CephFS
        ;;
     ceph)
        # no way to check consistency for CephFS
        ;;
+    glusterfs)
+       # no way to check consistency for GlusterFS
+       ;;
     overlay)
        # no way to check consistency for overlay
        ;;
     overlay)
        # no way to check consistency for overlay
        ;;
@@ -2468,6 +2495,9 @@ _check_scratch_fs()
     ceph)
        # no way to check consistency for CephFS
        ;;
     ceph)
        # no way to check consistency for CephFS
        ;;
+    glusterfs)
+       # no way to check consistency for GlusterFS
+       ;;
     overlay)
        # no way to check consistency for overlay
        ;;
     overlay)
        # no way to check consistency for overlay
        ;;