diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2020-08-24 23:31:26 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2020-08-24 23:31:26 +0000 |
commit | eda14cbc264d6969b02f2b1994cef11148e914f1 (patch) | |
tree | 54766ce51e901d5ec66cdce87973bb1e210588e1 /sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh | |
parent | 8d9b400f9d02116e528968fa4e7d3c479e326e2a (diff) | |
parent | 3b0ce0e28db46d0403929aba45c682285e1ac217 (diff) | |
download | src-eda14cbc264d6969b02f2b1994cef11148e914f1.tar.gz src-eda14cbc264d6969b02f2b1994cef11148e914f1.zip |
Initial import from vendor-sys branch of openzfs
Notes
Notes:
svn path=/head/; revision=364740
Diffstat (limited to 'sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh')
-rwxr-xr-x | sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh new file mode 100755 index 000000000000..4f904d11ddda --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_offline_export_import_online.ksh @@ -0,0 +1,62 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2019 by Tim Chase. All rights reserved. +# Copyright (c) 2019 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_trim/zpool_trim.kshlib + +# +# DESCRIPTION: +# Miscellaneous complex sequences of operations function as expected. +# +# STRATEGY: +# 1. Create a pool with a two-way mirror. +# 2. Start trimming, offline, export, import, online and verify that +# trimming state is preserved / trimming behaves as expected +# at each step. +# + +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" + +log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 + +log_must zpool trim -r 128M $TESTPOOL $DISK1 +log_must zpool offline $TESTPOOL $DISK1 +progress="$(trim_progress $TESTPOOL $DISK1)" +[[ -z "$progress" ]] && log_fail "Trimming did not start" +log_mustnot eval "trim_prog_line $TESTPOOL $DISK1 | grep suspended" + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL + +new_progress="$(trim_progress $TESTPOOL $DISK1)" +[[ -z "$new_progress" ]] && log_fail "Trimming did not start after import" +[[ "$new_progress" -ge "$progress" ]] || \ + log_fail "Trimming lost progress after import" +log_mustnot eval "trim_prog_line $TESTPOOL $DISK1 | grep suspended" + +log_must zpool online $TESTPOOL $DISK1 +new_progress="$(trim_progress $TESTPOOL $DISK1)" +[[ "$new_progress" -ge "$progress" ]] || \ + log_fail "Trimming lost progress after online" + +log_pass "Trimming behaves as expected at each step of:" \ + "trim + offline + export + import + online" |