da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#!/bin/ksh -p
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# CDDL HEADER START
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Common Development and Distribution License (the "License").
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# You may not use this file except in compliance with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# or http://www.opensolaris.org/os/licensing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Copyright (c) 2016 by Delphix. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin. $STF_SUITE/include/libtest.shlib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# DESCRIPTION:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 'zfs inherit' should return an error with bad parameters in one command.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz# STRATEGY:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 1. Set an array of bad options and invlid properties to 'zfs inherit'
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 2. Execute 'zfs inherit' with bad options and passing invlid properties
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 3. Verify an error is returned.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinverify_runnable "both"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfunction cleanup
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for ds in $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL ; do
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if snapexists $ds@$TESTSNAP; then
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin log_must zfs destroy $ds@$TESTSNAP
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin fi
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin done
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin cleanup_user_prop $TESTPOOL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_assert "'zfs inherit' should inherit user property."
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_onexit cleanup
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
for ds in $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL ; do
typeset prop_name=$(valid_user_property 10)
typeset value=$(user_property_value 16)
log_must eval "zfs set $prop_name='$value' $ds"
log_must zfs snapshot $ds@$TESTSNAP
typeset snapvalue=$(get_prop $prop_name $ds@$TESTSNAP)
if [[ "$snapvalue" != "$value" ]] ; then
log_fail "The '$ds@$TESTSNAP '$prop_name' value '$snapvalue' " \
"not equal to the expected value '$value'."
fi
snapvalue=$(user_property_value 16)
log_must eval "zfs set $prop_name='$snapvalue' $ds@$TESTSNAP"
log_must zfs inherit $prop_name $ds@$TESTSNAP
snapvalue=$(get_prop $prop_name $ds@$TESTSNAP)
if [[ "$snapvalue" != "$value" ]] ; then
log_fail "The '$ds@$TESTSNAP '$prop_name' value '$snapvalue' " \
"not equal to the expected value '$value'."
fi
done
log_pass "'zfs inherit' inherit user property."