common: handle ceph's new mount syntax
PATCH v3 1/1 common: handle ceph's new mount syntax
Cephfs is introducing a new mount device syntax. Fix the fstests infrastructure to handle the new syntax correctly.
Cc Zorro Lang <[email protected]>
Signed-off-by Jeff Layton <[email protected]>
--- common/config | 8 ++++++++ common/rc | 22 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-)
v2: more rigorous check for ceph mount device in _check_device
v3: consolidate multiple grep commands into single regex
common/config +8 -0
@@ -537,6 +537,14 @@ _check_device() # 9p and virtiofs mount tags are just plain strings, so anything is allowed # tmpfs doesn't use mount source, ignore ;; + ceph) + # ceph has two different possible syntaxes for mount devices. The + # network URL check above catches the legacy syntax. Check for the + # new-style syntax here. + if ( echo $dev | grep -qEv "=/" ); then + _fatal "common/config: $name ($dev) is not a valid ceph mount string" + fi + ;; overlay) if [ ! -d "$dev" ]; then _fatal "common/config: $name ($dev) is not a directory for overlay"
common/rc +20 -2
@@ -1592,7 +1592,7 @@ _require_scratch_nocheck() _notrun "this test requires a valid \$SCRATCH_MNT" fi ;; - nfs*|ceph) + nfs*) echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1 if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then _notrun "this test requires a valid \$SCRATCH_DEV"
@@ -1601,6 +1601,15 @@ _require_scratch_nocheck() _notrun "this test requires a valid \$SCRATCH_MNT" fi ;; + ceph) + echo $SCRATCH_DEV | grep -qE "=/|:/" > /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 + ;; pvfs2) echo $SCRATCH_DEV | grep -q "://" > /dev/null 2>&1 if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
@@ -1783,7 +1792,7 @@ _require_test() _notrun "this test requires a valid \$TEST_DIR" fi ;; - nfs*|ceph) + nfs*) echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1 if [ -z "$TEST_DEV" -o "$?" != "0" ]; then _notrun "this test requires a valid \$TEST_DEV"
@@ -1792,6 +1801,15 @@ _require_test() _notrun "this test requires a valid \$TEST_DIR" fi ;; + ceph) + echo $TEST_DEV | grep -qE "=/|:/" > /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 + ;; cifs) echo $TEST_DEV | grep -q "//" > /dev/null 2>&1 if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
Signature · 1 line
2.33.1
Quoted 6 lines · Jeff Layton
Cephfs is introducing a new mount device syntax. Fix the fstests infrastructure to handle the new syntax correctly.
Cc Zorro Lang <[email protected]>Signed-off-by Jeff Layton <[email protected]>---
It looks good to me now.
Reviewed-by Zorro Lang <[email protected]>
Quoted 83 lines
common/config | 8 ++++++++ common/rc | 22 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-)v2: more rigorous check for ceph mount device in
_check_device
v3: consolidate multiple grep commands into single regexcommon/config +8
-0@@ -537,6 +537,14 @@ _check_device() # 9p and virtiofs mount tags are just plain strings, so anything is allowed # tmpfs doesn't use mount source, ignore ;; + ceph) + # ceph has two different possible syntaxes for mount devices. The + # network URL check above catches the legacy syntax. Check for the + # new-style syntax here. + if ( echo $dev | grep -qEv "=/" ); then + _fatal "common/config: $name ($dev) is not a valid ceph mount string" + fi + ;; overlay) if [ ! -d "$dev" ]; then _fatal "common/config: $name ($dev) is not a directory for overlay"common/rc +20
-2@@ -1592,7 +1592,7 @@ _require_scratch_nocheck() _notrun "this test requires a valid \$SCRATCH_MNT" fi ;; - nfs*|ceph) + nfs*) echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1 if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then _notrun "this test requires a valid \$SCRATCH_DEV"@@ -1601,6 +1601,15 @@ _require_scratch_nocheck() _notrun "this test requires a valid \$SCRATCH_MNT" fi ;; + ceph) + echo $SCRATCH_DEV | grep -qE "=/|:/" > /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 + ;; pvfs2) echo $SCRATCH_DEV | grep -q "://" > /dev/null 2>&1 if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then@@ -1783,7 +1792,7 @@ _require_test() _notrun "this test requires a valid \$TEST_DIR" fi ;; - nfs*|ceph) + nfs*) echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1 if [ -z "$TEST_DEV" -o "$?" != "0" ]; then _notrun "this test requires a valid \$TEST_DEV"@@ -1792,6 +1801,15 @@ _require_test() _notrun "this test requires a valid \$TEST_DIR" fi ;; + ceph) + echo $TEST_DEV | grep -qE "=/|:/" > /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 + ;; cifs) echo $TEST_DEV | grep -q "//" > /dev/null 2>&1 if [ -z "$TEST_DEV" -o "$?" != "0" ]; thenSignature · 1 line
2.33.1