1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright (c) 2023 Hewlett Packard Enterprise Development LP. 25# 26 27. $STF_SUITE/include/libtest.shlib 28. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib 29 30# 31# DESCRIPTION: 32# Verify 'zpool clear' doesn't cause concurrent resilvers 33# 34# STRATEGY: 35# 1. Create N(10) virtual disk files. 36# 2. Create draid pool based on the virtual disk files. 37# 3. Fill the filesystem with directories and files. 38# 4. Force-fault 2 vdevs and verify distributed spare is kicked in. 39# 5. Free the distributed spare by replacing the faulty drive. 40# 6. Run zpool clear and verify that it does not initiate 2 resilvers 41# concurrently while distributed spare gets kicked in. 42# 43 44verify_runnable "global" 45 46typeset -ir devs=10 47typeset -ir nparity=1 48typeset -ir ndata=8 49typeset -ir dspare=1 50 51function cleanup 52{ 53 poolexists "$TESTPOOL" && destroy_pool "$TESTPOOL" 54 55 for i in {0..$devs}; do 56 log_must rm -f "$BASEDIR/vdev$i" 57 done 58 59 for dir in $BASEDIR; do 60 if [[ -d $dir ]]; then 61 log_must rm -rf $dir 62 fi 63 done 64 65 zed_stop 66 zed_cleanup 67} 68 69log_assert "Verify zpool clear on draid pool doesn't cause concurrent resilvers" 70log_onexit cleanup 71 72setup_test_env $TESTPOOL draid${nparity}:${ndata}d:${dspare}s $devs 73 74# ZED needed for sequential resilver 75zed_setup 76log_must zed_start 77 78log_must zpool offline -f $TESTPOOL $BASEDIR/vdev5 79log_must wait_vdev_state $TESTPOOL draid1-0-0 "ONLINE" 60 80log_must zpool wait -t resilver $TESTPOOL 81log_must zpool offline -f $TESTPOOL $BASEDIR/vdev6 82 83log_must zpool labelclear -f $BASEDIR/vdev5 84log_must zpool labelclear -f $BASEDIR/vdev6 85 86log_must zpool replace -w $TESTPOOL $BASEDIR/vdev5 87sync_pool $TESTPOOL 88 89log_must zpool events -c 90log_must zpool clear $TESTPOOL 91log_must wait_vdev_state $TESTPOOL draid1-0-0 "ONLINE" 60 92log_must zpool wait -t resilver $TESTPOOL 93log_must zpool wait -t scrub $TESTPOOL 94 95nof_resilver=$(zpool events | grep -c resilver_start) 96if [ $nof_resilver = 1 ] ; then 97 log_must verify_pool $TESTPOOL 98 log_pass "zpool clear on draid pool doesn't cause concurrent resilvers" 99else 100 log_fail "FAIL: sequential and healing resilver initiated concurrently" 101fi 102