xfs: modify quota tests to work on generic filesystems

Fix several xfs quota tests to work on non-xfs filesystems.

New _require function to be sure that the xfs_quota tool can operate
on foreign filesystems; if it can, and if it needs to, it adds "-f"
to the XFS_QUOTA_PROG variable.

Modify _qmount to do quotacheck/quotaon to mount and /enable/
quota.  On xfs this isn't needed and/or fails; it's ignored.

All quota-related options used as arguments to _qmount are changed
from i.e. uquota to i.e. usrquota; the latter is standard across
almost all linux filesytems, including xfs.

xfs/260 filters out the root/default quota line, because ext4
consumes a different amount of space than xfs, and it's not what
we're testing for, so just ignore it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eric Sandeen
2016-09-22 13:54:16 -05:00
committed by Eryu Guan
parent bda2cdea40
commit ee25b89d8c
6 changed files with 47 additions and 30 deletions
+20
View File
@@ -77,6 +77,20 @@ _require_xfs_quota()
[ -n "$XFS_QUOTA_PROG" ] || _notrun "XFS quota user tools not installed"
}
#
# checks that xfs_quota can operate on foreign (non-xfs) filesystems
# Skips check on xfs filesystems, old xfs_quota is fine there.
# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
#
_require_xfs_quota_foreign()
{
if [ "$FSTYP" != "xfs" ]; then
$XFS_QUOTA_PROG -f -V &>/dev/null || \
_notrun "xfs_quota binary does not support foreign filesystems"
XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
fi
}
#
# checks that the XFS project quota support in the kernel is enabled.
#
@@ -169,6 +183,12 @@ _qmount()
{
_scratch_unmount >/dev/null 2>&1
_scratch_mount || _fail "qmount failed"
# xfs doesn't need these setups and quotacheck even fails on xfs
# redirect the output to $seqres.full for debug purpose and ignore results
if [ "$FSTYP" != "xfs" ]; then
quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1
fi
chmod ugo+rwx $SCRATCH_MNT
}