#
# 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) 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# User defined property are always inherited from its parent dataset
# directly.
#
# STRATEGY:
# 1. Create pool, fs, volume, fsclone & volclone.
# 2. Get random user property name and set to the pool
# 3. Verify all dataset user property inherit from pool.
# 4. Set intermediate dataset and verify its children will inherit user
# property from it directly.
#
verify_runnable "both"
function cleanup
{
typeset dtst
if datasetexists $dtst; then
fi
done
}
#
# Verify options datasets (3-n) inherit from the inherited dataset $2.
#
# $1 user property
# $2 inherited dataset
# $3-n datasets
#
function inherit_check
{
typeset prop=$1
typeset inherited_dtst=$2
shift 2
[[ -z $@ ]] && return 1
typeset inherited_value=$(get_prop $prop $inherited_dtst)
typeset source=$(get_source $prop $dtst)
then
return 1
fi
shift
done
return 0
}
log_assert "User defined property inherited from its parent."
prop_name=$(valid_user_property 10)
value=$(user_property_value 16)
log_must eval "zfs set $prop_name='$value' $pool"
log_must eval "check_user_prop $pool $prop_name '$value'"
log_note "Set intermediate dataset will change the inherited relationship."
new_value=$(user_property_value 16)
log_must eval "zfs set $prop_name='$new_value' $fs"
log_must eval "check_user_prop $fs $prop_name '$new_value'"
log_pass "User defined property inherited from its parent passed."