blob: 5003b5f10bdb350abc505c4af24dea227cd3bbb7 [file] [log] [blame]
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib
#
# DESCRIPTION:
# Starting and stopping an initialize works.
#
# STRATEGY:
# 1. Create a one-disk pool.
# 2. Start initializing and verify that initializing is active.
# 3. Cancel initializing and verify that initializing is not active.
#
DISK1=${DISKS%% *}
log_must zpool create -f $TESTPOOL $DISK1
log_must zpool initialize $TESTPOOL
[[ -z "$(initialize_progress $TESTPOOL $DISK1)" ]] && \
log_fail "Initialize did not start"
log_must zpool initialize -c $TESTPOOL
[[ -z "$(initialize_progress $TESTPOOL $DISK1)" ]] || \
log_fail "Initialize did not stop"
log_pass "Initialize start + cancel works"