zpool_import_012_pos.ksh revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
#
# 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 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Once a pool has been exported, it should be recreated after a
# successful import, all the sub-filesystems within it should all be restored,
# include mount & share status. Verify that is true.
#
# STRATEGY:
# 1. Create the test pool and hierarchical filesystems.
# 2. Export the test pool, or destroy the test pool,
# depend on testing import [-Df].
# 3. Import it using the various combinations.
# - Regular import
# - Alternate Root Specified
# 4. Verify the mount & share status is restored.
#
verify_runnable "global"
set -A pools "$TESTPOOL" "$TESTPOOL1"
set -A devs "" "-d $DEVICE_DIR"
set -A options "" "-R $ALTER_ROOT"
function cleanup
{
typeset -i i=0
while ((i < ${#pools[*]})); do
if poolexists ${pools[i]}; then
log_note "Try to import ${devs[i]} ${pools[i]}"
else
fi
if poolexists ${pools[i]}; then
fi
((i = i + 1))
done
if datasetexists $TESTPOOL/$TESTFS; then
fi
[[ -d $ALTER_ROOT ]] && \
}
log_assert "Verify all mount & share status of sub-filesystems within a pool \
can be restored after import [-Df]."
# create a heirarchy of filesystem
done
typeset mount_fs="$TESTFS $TESTFS/$TESTFS1 $TESTCLONE1 \
typeset -i i=0
typeset -i j=0
typeset -i nfs_share_bit=0
typeset -i guid_bit=0
typeset basedir
i=0
while ((i < ${#pools[*]})); do
j=0
while ((j < ${#options[*]})); do
typeset f_share=""
typeset nfs_flag="sharenfs=off"
f_share="true"
nfs_flag="sharenfs=on"
fi
guid_bit=0
typeset guid_flag="pool name"
if [[ -z $option ]]; then
else
fi
log_note "Import by guid."
if [[ -z $guid ]]; then
"not be empty!"
else
fi
fi
#import by GUID if import by pool name fails
if [[ $? != 0 ]]; then
"duplicates. Try GUID import"
fi
[[ -n $f_share ]] && \
done
for fs in $nomount_fs; do
done
done
# reset nfsshare=off
if [[ -n $f_share ]]; then
fi
done
((j = j + 1))
done
((i = i + 1))
done
done
log_pass "All mount & share status of sub-filesystems within a pool \
can be restored after import [-Df]."