diff options
author | Brian Behlendorf <[email protected]> | 2024-09-28 09:18:21 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-28 09:18:21 -0700 |
commit | 834b90fb819e0887e05d6069cb9e74033dca1541 (patch) | |
tree | d8f382c90ff147a7a9798bddaccdbab5f2b1d7f5 | |
parent | 6f50f8e16b7c4a3f1925b41e3d47b479cd7b2d9f (diff) |
ZTS: Fix zpool_import_hostid_changed_unclean_export
Update the test case to freeze the pool then export it to better
simulate a hard failure. This is preferable to copying the vdev
while the pool's imported since with a copy we're not guaranteed
the on-disk state will be consistent. That can in turn result
in a pool import failure and a spurious test failure.
Reviewed-by: Tino Reichardt <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #16578
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_unclean_export.ksh | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_unclean_export.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_unclean_export.ksh index ad8cca642..abbe9acff 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_unclean_export.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_hostid_changed_unclean_export.ksh @@ -27,8 +27,8 @@ # 1. Set a hostid. # 2. Create a pool. # 3. Simulate the pool being torn down without export: -# 3.1. Copy the underlying device state. -# 3.2. Export the pool. +# 3.1. Sync then freeze the pool. +# 3.2. Export the pool (uncleanly). # 3.3. Restore the device state from the copy. # 4. Change the hostid. # 5. Verify that importing the pool fails. @@ -52,10 +52,9 @@ log_must zgenhostid -f $HOSTID1 log_must zpool create $TESTPOOL1 $VDEV0 # 3. Simulate the pool being torn down without export. -log_must cp $VDEV0 $VDEV0.bak +sync_pool $TESTPOOL1 +log_must zpool freeze $TESTPOOL1 log_must zpool export $TESTPOOL1 -log_must cp -f $VDEV0.bak $VDEV0 -log_must rm -f $VDEV0.bak # 4. Change the hostid. log_must zgenhostid -f $HOSTID2 |