5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2016, loli10K. All rights reserved.
27 . $STF_SUITE/include/libtest.shlib
28 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
32 # Temporary pool names should not be persisted on devices.
35 # 1. Create pool A, then export it.
36 # 2. Re-import the pool with a temporary name B, then export it.
37 # 3. Verify device labels still contain the expected pool name (A).
40 verify_runnable "global"
45 for dt in $poolB $poolA; do
49 log_must rm -rf $DEVICE_DIR/*
51 while (( i < $MAX_NUM )); do
52 log_must mkfile $FILE_SIZE ${DEVICE_DIR}/${DEVICE_FILE}$i
58 # Verify name of (exported) pool from device $1 label is equal to $2
62 function verify_pool_name
68 zdb -e -l $device | grep " name:" | {
69 while read labelname ; do
70 if [[ "name: '$poolname'" != "$labelname" ]]; then
78 log_assert "Temporary pool names should not be persisted on devices."
81 poolA=poolA.$$; poolB=poolB.$$;
83 log_must zpool create $poolA $VDEV0
84 log_must zpool export $poolA
86 log_must zpool import -t $poolA $poolB -d $DEVICE_DIR
87 log_must zpool export $poolB
89 log_must eval "verify_pool_name $VDEV0 $poolA"
91 log_pass "Temporary pool names are not persisted on devices."