#
# 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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify that 'zpool import -a' succeeds as root.
#
# STRATEGY:
# 1. Create a group of pools with specified vdev.
# 2. Create zfs filesystems within the given pools.
# 3. Export the pools.
# 4. Verify that import command succeed.
#
verify_runnable "global"
set -A options "" "-R $ALTER_ROOT"
typeset -i number=0
typeset -i id=0
typeset -i i=0
typeset checksum1
typeset unwantedpool
{
typeset disk=$1
typeset pool=$2
typeset fs=${3##/}
typeset mtpt=$4
setup_filesystem "$disk" "$pool" "$fs" "$mtpt"
[[ -d $mtpt ]] && \
}
function cleanup_all
{
typeset -i id=0
#
# Try import individually if 'import -a' failed.
#
done
log_must zpool import -d $DEVICE_DIR -f $pool
done
if ! poolexists ${TESTPOOL}-$id ; then
continue
fi
[[ -e $TESTDIR/$TESTFILE0 ]] && \
else
fi
done
[[ -d $ALTER_ROOT ]] && \
}
{
typeset alter_root=$1
typeset -i id=0
typeset file
typeset checksum2
continue
fi
else
fi
[[ ! -e $file ]] && \
log_fail "Checksums differ ($checksum1 != $checksum2)"
done
return 0
}
log_assert "Verify that 'zpool import -a' succeeds as root."
[[ -d /${TESTPOOL}-0 ]] && \
#
# setup exported pools on normal devices
#
number=1
continue
fi
setup_single_disk "${ZFS_DISK1}s${number}" \
"${TESTPOOL}-$number" \
"$TESTFS" \
done
#
# setup exported pools on raw files
#
do
"${TESTPOOL}-$number" \
"$TESTFS" \
done
while (( i < ${#options[*]} )); do
# destroy unintentional imported pools
for unwantedpool in $(zpool list -H -o name \
log_must zpool export $unwantedpool
done
if [[ -n ${options[i]} ]]; then
else
fi
id=0
if poolexists ${TESTPOOL}-$id ; then
fi
done
(( i = i + 1 ))
done
log_pass "'zpool import -a' succeeds as root."