1d583b39bSJohn Wren Kennedy#!/usr/bin/ksh -p 2d583b39bSJohn Wren Kennedy# 3d583b39bSJohn Wren Kennedy# CDDL HEADER START 4d583b39bSJohn Wren Kennedy# 5d583b39bSJohn Wren Kennedy# The contents of this file are subject to the terms of the 6d583b39bSJohn Wren Kennedy# Common Development and Distribution License (the "License"). 7d583b39bSJohn Wren Kennedy# You may not use this file except in compliance with the License. 8d583b39bSJohn Wren Kennedy# 9d583b39bSJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10d583b39bSJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 11d583b39bSJohn Wren Kennedy# See the License for the specific language governing permissions 12d583b39bSJohn Wren Kennedy# and limitations under the License. 13d583b39bSJohn Wren Kennedy# 14d583b39bSJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 15d583b39bSJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16d583b39bSJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 17d583b39bSJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 18d583b39bSJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 19d583b39bSJohn Wren Kennedy# 20d583b39bSJohn Wren Kennedy# CDDL HEADER END 21d583b39bSJohn Wren Kennedy# 22d583b39bSJohn Wren Kennedy 23d583b39bSJohn Wren Kennedy# 24d583b39bSJohn Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25d583b39bSJohn Wren Kennedy# Use is subject to license terms. 26d583b39bSJohn Wren Kennedy# 27d583b39bSJohn Wren Kennedy 28d583b39bSJohn Wren Kennedy# 29*1d32ba66SJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 30c2b09db8SYuri Pankov# Copyright 2015 Nexenta Systems, Inc. All rights reserved. 31d583b39bSJohn Wren Kennedy# 32d583b39bSJohn Wren Kennedy 33d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib 34d583b39bSJohn Wren Kennedy 35d583b39bSJohn Wren Kennedy# 36d583b39bSJohn Wren Kennedy# DESCRIPTION: 37d583b39bSJohn Wren Kennedy# zpool upgrade -a works 38d583b39bSJohn Wren Kennedy# 39d583b39bSJohn Wren Kennedy# STRATEGY: 40d583b39bSJohn Wren Kennedy# 1. Create all upgradable pools for this system, then upgrade -a 41d583b39bSJohn Wren Kennedy# 2. Verify a 0 exit status 42d583b39bSJohn Wren Kennedy# 43d583b39bSJohn Wren Kennedy 44d583b39bSJohn Wren Kennedyverify_runnable "global" 45d583b39bSJohn Wren Kennedy 46d583b39bSJohn Wren Kennedyfunction cleanup 47d583b39bSJohn Wren Kennedy{ 48c2b09db8SYuri Pankov for config in $CONFIGS; do 49d583b39bSJohn Wren Kennedy destroy_upgraded_pool $config 50d583b39bSJohn Wren Kennedy done 51d583b39bSJohn Wren Kennedy} 52d583b39bSJohn Wren Kennedy 53d583b39bSJohn Wren Kennedylog_assert "zpool upgrade -a works" 54d583b39bSJohn Wren Kennedylog_onexit cleanup 55d583b39bSJohn Wren Kennedy 56d583b39bSJohn Wren KennedyTEST_POOLS= 57d583b39bSJohn Wren Kennedy# Now build all of our pools 58c2b09db8SYuri Pankovfor config in $CONFIGS; do 59c2b09db8SYuri Pankov typeset -n pool_name=ZPOOL_VERSION_${config}_NAME 60d583b39bSJohn Wren Kennedy 61c2b09db8SYuri Pankov TEST_POOLS="$TEST_POOLS $pool_name" 62d583b39bSJohn Wren Kennedy create_old_pool $config 63c2b09db8SYuri Pankov check_pool $pool_name pre > /dev/null 64d583b39bSJohn Wren Kennedydone 65d583b39bSJohn Wren Kennedy 66d583b39bSJohn Wren Kennedy# upgrade them all at once 67d583b39bSJohn Wren Kennedyexport __ZFS_POOL_RESTRICT="$TEST_POOLS" 68*1d32ba66SJohn Wren Kennedylog_must zpool upgrade -a 69d583b39bSJohn Wren Kennedyunset __ZFS_POOL_RESTRICT 70d583b39bSJohn Wren Kennedy 71d583b39bSJohn Wren Kennedy# verify their contents then destroy them 72c2b09db8SYuri Pankovfor config in $CONFIGS ; do 73c2b09db8SYuri Pankov typeset -n pool_name=ZPOOL_VERSION_${config}_NAME 74d583b39bSJohn Wren Kennedy 75c2b09db8SYuri Pankov check_pool $pool_name post > /dev/null 76*1d32ba66SJohn Wren Kennedy log_must diff /$TESTPOOL/pool-checksums.$pool_name.pre \ 77c2b09db8SYuri Pankov /$TESTPOOL/pool-checksums.$pool_name.post 78*1d32ba66SJohn Wren Kennedy rm /$TESTPOOL/pool-checksums.$pool_name.pre \ 79c2b09db8SYuri Pankov /$TESTPOOL/pool-checksums.$pool_name.post 80d583b39bSJohn Wren Kennedy destroy_upgraded_pool $config 81d583b39bSJohn Wren Kennedydone 82d583b39bSJohn Wren Kennedy 83d583b39bSJohn Wren Kennedylog_pass "zpool upgrade -a works" 84