1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# This file and its contents are supplied under the terms of the 6# Common Development and Distribution License ("CDDL"), version 1.0. 7# You may only use this file in accordance with the terms of version 8# 1.0 of the CDDL. 9# 10# A full copy of the text of the CDDL should have accompanied this 11# source. A copy of the CDDL is also available via the Internet at 12# http://www.illumos.org/license/CDDL. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright (c) 2021 Lawrence Livermore National Security, LLC. 19# 20 21. $STF_SUITE/include/libtest.shlib 22. $STF_SUITE/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib 23 24# 25# DESCRIPTION: 26# Miscellaneous complex sequences of operations function as expected. 27# 28# STRATEGY: 29# 1. Create a pool with a two-way mirror. 30# 2. Start initializing, fault, export, import, online and verify along 31# the way that the initializing was cancelled and not restarted. 32# 33 34DISK1="$(echo $DISKS | cut -d' ' -f1)" 35DISK2="$(echo $DISKS | cut -d' ' -f2)" 36 37log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 38 39log_must zpool initialize $TESTPOOL $DISK1 40progress="$(initialize_progress $TESTPOOL $DISK1)" 41[[ -z "$progress" ]] && log_fail "Initializing did not start" 42 43log_must zpool offline -f $TESTPOOL $DISK1 44log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" 45log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" 46 47log_must zpool export $TESTPOOL 48log_must zpool import $TESTPOOL 49 50log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" 51log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" 52 53log_must zpool online $TESTPOOL $DISK1 54log_must zpool clear $TESTPOOL $DISK1 55log_must check_vdev_state $TESTPOOL $DISK1 "ONLINE" 56log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" 57 58log_pass "Initializing behaves as expected at each step of:" \ 59 "initialize + fault + export + import + online" 60