1#!/bin/ksh 2 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2019, Datto Inc. All rights reserved. 16# Copyright (c) 2020 by Lawrence Livermore National Security, LLC. 17# 18 19. $STF_SUITE/include/libtest.shlib 20. $STF_SUITE/tests/functional/replacement/replacement.cfg 21 22# 23# Description: 24# Verify that on import an in progress attach operation is resumed. 25# 26# Strategy: 27# 1. For both healing and sequential resilvering. 28# a. Create a pool 29# b. Add a vdev with 'zpool attach' and resilver (-s) it. 30# c. Export the pool 31# d. Import the pool 32# e. Verify the 'zpool attach' resumed resilvering 33# f. Destroy the pool 34# 35 36function cleanup 37{ 38 log_must set_tunable32 SCAN_SUSPEND_PROGRESS \ 39 $ORIG_SCAN_SUSPEND_PROGRESS 40 destroy_pool $TESTPOOL1 41 rm -f ${VDEV_FILES[@]} 42} 43 44log_assert "Verify attach is resumed on import" 45 46ORIG_SCAN_SUSPEND_PROGRESS=$(get_tunable SCAN_SUSPEND_PROGRESS) 47 48log_onexit cleanup 49 50log_must truncate -s $VDEV_FILE_SIZE ${VDEV_FILES[@]} 51 52# Verify healing and sequential resilver resume on import. 53for arg in "" "-s"; do 54 log_must zpool create -f $TESTPOOL1 ${VDEV_FILES[0]} 55 log_must set_tunable32 SCAN_SUSPEND_PROGRESS 1 56 log_must zpool attach $arg $TESTPOOL1 ${VDEV_FILES[0]} ${VDEV_FILES[1]} 57 log_must is_pool_resilvering $TESTPOOL1 58 log_must zpool export $TESTPOOL1 59 log_must zpool import -d $TEST_BASE_DIR $TESTPOOL1 60 log_must is_pool_resilvering $TESTPOOL1 61 log_must set_tunable32 SCAN_SUSPEND_PROGRESS $ORIG_SCAN_SUSPEND_PROGRESS 62 log_must zpool wait -t resilver $TESTPOOL1 63 log_must is_pool_resilvered $TESTPOOL1 64 destroy_pool $TESTPOOL1 65done 66 67log_pass "Verify attach is resumed on import" 68