1d583b39bSJohn Wren Kennedy#!/bin/ksh -p 2d583b39bSJohn Wren Kennedy# 3d583b39bSJohn Wren Kennedy# CDDL HEADER START 4d583b39bSJohn Wren Kennedy# 5d583b39bSJohn Wren Kennedy# The contents of this file are subject to the terms of the 6d583b39bSJohn Wren Kennedy# Common Development and Distribution License (the "License"). 7d583b39bSJohn Wren Kennedy# You may not use this file except in compliance with the License. 8d583b39bSJohn Wren Kennedy# 9d583b39bSJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10d583b39bSJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 11d583b39bSJohn Wren Kennedy# See the License for the specific language governing permissions 12d583b39bSJohn Wren Kennedy# and limitations under the License. 13d583b39bSJohn Wren Kennedy# 14d583b39bSJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 15d583b39bSJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16d583b39bSJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 17d583b39bSJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 18d583b39bSJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 19d583b39bSJohn Wren Kennedy# 20d583b39bSJohn Wren Kennedy# CDDL HEADER END 21d583b39bSJohn Wren Kennedy# 22d583b39bSJohn Wren Kennedy 23d583b39bSJohn Wren Kennedy# 24d583b39bSJohn Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25d583b39bSJohn Wren Kennedy# Use is subject to license terms. 26d583b39bSJohn Wren Kennedy# 27d583b39bSJohn Wren Kennedy 28d583b39bSJohn Wren Kennedy# 29*1d32ba66SJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 30d583b39bSJohn Wren Kennedy# 31d583b39bSJohn Wren Kennedy 32d583b39bSJohn Wren Kennedy. $STF_SUITE/include/libtest.shlib 33d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create.cfg 34d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib 35d583b39bSJohn Wren Kennedy. $STF_SUITE/tests/functional/cli_root/zfs_create/properties.kshlib 36d583b39bSJohn Wren Kennedy 37d583b39bSJohn Wren Kennedy# 38d583b39bSJohn Wren Kennedy# DESCRIPTION: 39d583b39bSJohn Wren Kennedy# 'zfs create -o property=value -V size volume' can successfully create a ZFS 40d583b39bSJohn Wren Kennedy# volume with multiple properties set. 41d583b39bSJohn Wren Kennedy# 42d583b39bSJohn Wren Kennedy# STRATEGY: 43d583b39bSJohn Wren Kennedy# 1. Create a ZFS volume in the storage pool with -o option 44d583b39bSJohn Wren Kennedy# 2. Verify the volume created successfully 45d583b39bSJohn Wren Kennedy# 3. Verify the properties are correctly set 46d583b39bSJohn Wren Kennedy# 47d583b39bSJohn Wren Kennedy 48d583b39bSJohn Wren Kennedyverify_runnable "global" 49d583b39bSJohn Wren Kennedy 50d583b39bSJohn Wren Kennedyfunction cleanup 51d583b39bSJohn Wren Kennedy{ 52e9316f76SJoe Stein datasetexists $TESTPOOL/$TESTVOL && \ 53*1d32ba66SJohn Wren Kennedy log_must zfs destroy -f $TESTPOOL/$TESTVOL 54d583b39bSJohn Wren Kennedy datasetexists $TESTPOOL/$TESTVOL1 && \ 55*1d32ba66SJohn Wren Kennedy log_must zfs destroy -f $TESTPOOL/$TESTVOL1 56d583b39bSJohn Wren Kennedy} 57d583b39bSJohn Wren Kennedy 58d583b39bSJohn Wren Kennedylog_onexit cleanup 59d583b39bSJohn Wren Kennedy 60d583b39bSJohn Wren Kennedy 61d583b39bSJohn Wren Kennedylog_assert "'zfs create -o property=value -V size volume' can successfully \ 62d583b39bSJohn Wren Kennedy create a ZFS volume with correct property set." 63d583b39bSJohn Wren Kennedy 64d583b39bSJohn Wren Kennedytypeset -i i=0 65d583b39bSJohn Wren Kennedytypeset opts="" 66d583b39bSJohn Wren Kennedy 67d583b39bSJohn Wren Kennedywhile (( $i < ${#RW_VOL_PROP[*]} )); do 68d583b39bSJohn Wren Kennedy if [[ ${RW_VOL_PROP[$i]} != *"checksum"* ]]; then 69d583b39bSJohn Wren Kennedy opts="$opts -o ${RW_VOL_PROP[$i]}" 70d583b39bSJohn Wren Kennedy fi 71d583b39bSJohn Wren Kennedy (( i = i + 1 )) 72d583b39bSJohn Wren Kennedydone 73d583b39bSJohn Wren Kennedy 74*1d32ba66SJohn Wren Kennedylog_must zfs create $opts -V $VOLSIZE $TESTPOOL/$TESTVOL 75d583b39bSJohn Wren Kennedydatasetexists $TESTPOOL/$TESTVOL || \ 76d583b39bSJohn Wren Kennedy log_fail "zfs create $TESTPOOL/$TESTVOL fail." 77*1d32ba66SJohn Wren Kennedylog_must zfs create -s $opts -V $VOLSIZE $TESTPOOL/$TESTVOL1 78d583b39bSJohn Wren Kennedydatasetexists $TESTPOOL/$TESTVOL1 || \ 79d583b39bSJohn Wren Kennedy log_fail "zfs create $TESTPOOL/$TESTVOL1 fail." 80d583b39bSJohn Wren Kennedy 81d583b39bSJohn Wren Kennedyi=0 82d583b39bSJohn Wren Kennedywhile (( $i < ${#RW_VOL_PROP[*]} )); do 83d583b39bSJohn Wren Kennedy if [[ ${RW_VOL_PROP[$i]} != *"checksum"* ]]; then 84d583b39bSJohn Wren Kennedy propertycheck $TESTPOOL/$TESTVOL ${RW_VOL_PROP[i]} || \ 85d583b39bSJohn Wren Kennedy log_fail "${RW_VOL_PROP[i]} is failed to set." 86d583b39bSJohn Wren Kennedy propertycheck $TESTPOOL/$TESTVOL1 ${RW_VOL_PROP[i]} || \ 87d583b39bSJohn Wren Kennedy log_fail "${RW_VOL_PROP[i]} is failed to set." 88d583b39bSJohn Wren Kennedy fi 89d583b39bSJohn Wren Kennedy (( i = i + 1 )) 90d583b39bSJohn Wren Kennedydone 91d583b39bSJohn Wren Kennedy 92d583b39bSJohn Wren Kennedylog_pass "'zfs create -o property=value -V size volume' can successfully \ 93d583b39bSJohn Wren Kennedy create a ZFS volume with correct property set." 94