#
# 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) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify 'zfs get all' can get all properties for all datasets in the system
#
# STRATEGY:
# 1. Create datasets for testing
# 2. Issue 'zfs get all' command
# 3. Verify the command gets all available properties of all datasets
#
verify_runnable "both"
function cleanup
{
datasetexists $clone && \
snapexists $snap && \
done
if [[ -n $globalzone ]] ; then
for pool in $TESTPOOL1 $TESTPOOL2 $TESTPOOL3; do
poolexists $pool && \
done
done
else
datasetexists $fs && \
done
fi
}
log_assert "Verify the functions of 'zfs get all' work."
typeset globalzone=""
if is_global_zone ; then
globalzone="true"
fi
set -A opts "" "-r" "-H" "-p" "-rHp" "-o name" \
"-s local,default,temporary,inherited,none" \
"-o name -s local,default,temporary,inherited,none" \
"-rHp -o name -s local,default,temporary,inherited,none"
set -A usrprops "a:b=c" "d_1:1_e=0f" "123:456=789"
#set user defined properties for $TESTPOOL
done
# create snapshot and clone in $TESTPOOL
# collect datasets which can be set user defined properties
# collect all datasets which we are creating
#create pool and datasets to guarantee testing under multiple pools and datasets.
typeset FILESIZE=$MINVDEVSIZE
typeset -i VOLSIZE=10485760
typeset -i i=0
# make sure 'availspace' is larger then twice of FILESIZE to create a new pool.
# If any, we only totally create 3 pools for multple datasets testing to limit
# testing time
(( i += 1 ))
if [[ -n $globalzone ]] ; then
else
fi
#set user defined properties for testing
done
#create datasets in pool
if [[ -n $globalzone ]] ; then
else
fi
done
#the expected number of property for each type of dataset in this testing
typeset -i fspropnum=27
typeset -i snappropnum=8
typeset -i volpropnum=15
typeset -i i=0
typeset -i propnum=0
typeset -i failflag=0
while (( i < ${#opts[*]} )); do
(( $? != 0 )) && \
"dataset $ds in 'get all' output."
;;
snapshot )
;;
volume )
;;
esac
log_fail " 'zfs get all' fails to get out " \
"all properties for dataset $ds."
done
(( i += 1 ))
done
log_note "'zfs get' can get particular property for all datasets with that property."
{
typeset props="$1"
typeset ds="$2"
done
}
# Here, we do a testing for user defined properties and the most common properties
# for all datasets.
commprop="type creation used referenced compressratio"
usrprop="a:b d_1:1_e 123:456"
log_pass "'zfs get all' works as expected."