Skip to contentSkip to conversation

xfstests: test xfs_spaceman fsuuid command

PATCH In review Catherine Hoang 4 participants 6 messages Nov 9, 2022 – Nov 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: test xfs_spaceman fsuuid command

Add a test to verify the xfs_spaceman fsuuid functionality.

---
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
 tests/xfs/557.out |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out
tests/xfs/557 new file +31 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Catherine Hoang

Add a test to verify the xfs_spaceman fsuuid functionality.

Looks simple enough

Quoted 53 lines

---
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++ tests/xfs/557.out |  2 ++

 2 files changed, 33 insertions(+)

 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out

tests/xfs/557 new file +24 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID

($actual_uuid)"

tests/xfs/557 new file +7 -0
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
#2 lore raw
In reply to Catherine Hoang
Quoted 4 lines · Catherine Hoang

Add a test to verify the xfs_spaceman fsuuid functionality.

---

Hmm... I'm a little confused why we need this tool if we already has a "xfs_admin -u", and we even expect they get same fsuuid. Even if "xfs_admin -u" can't work with mountpoint, but it can work on the device which is mounted. And why not let xfs_admin support that ?

Anyway, I'm care more about if this command is acked by xfs list? If xfs list would like to have that command, then I'm OK to have this test coverage :)

Thanks,
Zorro

Quoted 54 lines
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
 tests/xfs/557.out |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out
tests/xfs/557 new file +31 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
Signature · 1 line
2.25.1
#3 lore raw
Quoted 5 lines · Zorro Lang
Quoted 2 lines · Catherine Hoang

Add a test to verify the xfs_spaceman fsuuid functionality.

Quoted 7 lines
Quoted 2 lines

---

Hmm... I'm a little confused why we need this tool if we already has a "xfs_admin -u", and we even expect they get same fsuuid. Even if "xfs_admin -u" can't work with mountpoint, but it can work on the device which is mounted. And why not let xfs_admin support that ?

We are trying to add a new ioctl to retrieve the uuid of a mounted filesystem. The eventual goal is to have “xfs_admin -u" wrap around this command and use it for cases when the filesystem is mounted.

Quoted 3 lines

Anyway, I'm care more about if this command is acked by xfs list? If xfs list would like to have that command, then I'm OK to have this test coverage :)

This is still under discussion on the xfs list so it will probably take some more time before it is accepted. Thanks!

Quoted 59 lines

Thanks,
Zorro

Quoted 54 lines

tests/xfs/557 | 31 +++++++++++++++++++++++++++++++
tests/xfs/557.out | 2 ++

2 files changed, 33 insertions(+)

create mode 100755 tests/xfs/557
create mode 100644 tests/xfs/557.out

tests/xfs/557 new file +31 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
Signature · 1 line
2.25.1
#4 lore raw
In reply to Catherine Hoang
Quoted 26 lines · Catherine Hoang

Add a test to verify the xfs_spaceman fsuuid functionality.

---
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
 tests/xfs/557.out |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out
tests/xfs/557 new file +10 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman

tests/xfs/557 line 20

Quoted 10 lines
tests/xfs/557 new file +10 -0
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"

A future xfs_admin.sh will be ported to call xfs_io if the filesystem is mounted, so you really ought to read the ondisk uuid straight from the debugger before mounting, and query the kernel after mounting:

_scratch_mkfs >> $seqres.full
expected_uuid=$(_scratch_xfs_get_sb_field uuid)

_scratch_mount >> $seqres.full actual_uuid=$($XFS_IO_PROG -c fsuuid $SCRATCH_MNT) if [ "$expected_uuid" != "$actual_uuid" ]; then

	...

fi

--D

Quoted 22 lines
tests/xfs/557 new file +11 -0
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
Signature · 1 line
2.25.1
#5 lore raw
Quoted 23 lines · Darrick J. Wong
Quoted 22 lines · Catherine Hoang

Add a test to verify the xfs_spaceman fsuuid functionality.

---
 tests/xfs/557     | 31 +++++++++++++++++++++++++++++++
 tests/xfs/557.out |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tests/xfs/557
 create mode 100644 tests/xfs/557.out
tests/xfs/557 new file +6 -0
new file mode 100755
index 00000000..0b41e693
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 557
+#
Quoted 8 lines

tests/xfs/557 line 14

Quoted 8 lines
tests/xfs/557 new file +8 -0
+# Test to verify xfs_spaceman fsuuid functionality
+#
+. ./common/preamble
+_begin_fstest auto quick spaceman
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_spaceman_command "fsuuid"

Also -- I think you need to patch _require_xfs_io_command to try the fsuuid command on the test fs and _notrun if the kernel doesn't understand the GETFSUUID ioctl.

(Assuming the command is moving from xfs_spaceman to xfs_io.)

--D

Quoted 44 lines

tests/xfs/557 line 20

Quoted 6 lines
tests/xfs/557 new file +6 -0
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount >> $seqres.full
+
+expected_uuid="$(_scratch_xfs_admin -u)"

A future xfs_admin.sh will be ported to call xfs_io if the filesystem is mounted, so you really ought to read the ondisk uuid straight from the debugger before mounting, and query the kernel after mounting:

_scratch_mkfs >> $seqres.full
expected_uuid=$(_scratch_xfs_get_sb_field uuid)

_scratch_mount >> $seqres.full actual_uuid=$($XFS_IO_PROG -c fsuuid $SCRATCH_MNT) if [ "$expected_uuid" != "$actual_uuid" ]; then

	...

fi

--D

Quoted 22 lines
tests/xfs/557 new file +11 -0
+actual_uuid="$($XFS_SPACEMAN_PROG -c "fsuuid" $SCRATCH_MNT)"
+
+if [ "$expected_uuid" != "$actual_uuid" ]; then
+        echo "expected UUID ($expected_uuid) != actual UUID ($actual_uuid)"
+fi
+
+echo "Silence is golden"
+
+# success, all done
+status=0
+exit
tests/xfs/557.out new file +2 -0
new file mode 100644
index 00000000..1f1ae1d4
@@ -0,0 +1,2 @@
+QA output created by 557
+Silence is golden
Signature · 1 line
2.25.1