history_001_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
#
# 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
# 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 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Create a scenario to verify the following zpool subcommands are logged.
# create, destroy, add, remove, offline, online, attach, detach, replace,
# scrub, export, import, clear, upgrade.
#
# STRATEGY:
# 1. Create three virtual disk files and create a mirror.
# 3. Import a pool and upgrade it, verifying 'upgrade' was logged.
#
verify_runnable "global"
function cleanup
{
[[ -d $import_dir ]] && rm -rf $import_dir
done
}
log_assert "Verify zpool sub-commands which modify state are logged."
run_and_verify -p "$MPOOL" "zpool create $MPOOL mirror $VDEV1 $VDEV2"
run_and_verify -p "$MPOOL" "zpool add -f $MPOOL spare $VDEV3"
run_and_verify -p "$MPOOL" "zpool remove $MPOOL $VDEV3"
run_and_verify -p "$MPOOL" "zpool offline $MPOOL $VDEV1"
run_and_verify -p "$MPOOL" "zpool online $MPOOL $VDEV1"
run_and_verify -p "$MPOOL" "zpool attach $MPOOL $VDEV1 $VDEV4"
run_and_verify -p "$MPOOL" "zpool detach $MPOOL $VDEV4"
run_and_verify -p "$MPOOL" "zpool replace -f $MPOOL $VDEV1 $VDEV4"
run_and_verify -p "$MPOOL" "zpool scrub $MPOOL"
run_and_verify -p "$MPOOL" "zpool clear $MPOOL"
# For export and destroy, mimic the behavior of run_and_verify using two
# commands since the history will be unavailable until the pool is imported
# again.
cmd1="${commands[$i]}"
cmd2="${commands[(($i + 1 ))]}"
done
run_and_verify -p "$MPOOL" "zpool split $MPOOL ${MPOOL}_split"
run_and_verify -p "$upgrade_pool" "zpool upgrade $upgrade_pool"
log_pass "zpool sub-commands which modify state are logged passed. "