1#!/bin/ksh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27. $STF_SUITE/include/libtest.shlib 28 29# 30# DESCRIPTION: 31# 'zfs promote' can successfully promote a volume clone. 32# 33# STRATEGY: 34# 1. Create a volume clone 35# 2. Promote the volume clone 36# 3. Verify the dependency changed. 37# 38 39verify_runnable "global" 40 41function cleanup 42{ 43 if snapexists $csnap; then 44 log_must $ZFS promote $vol 45 fi 46 47 log_must $ZFS destroy -rR $snap 48} 49 50log_assert "'zfs promote' can promote a volume clone." 51log_onexit cleanup 52 53vol=$TESTPOOL/$TESTVOL 54snap=$vol@$TESTSNAP 55clone=$TESTPOOL/volclone 56csnap=$clone@$TESTSNAP 57 58if ! snapexists $snap ; then 59 log_must $ZFS snapshot $snap 60 log_must $ZFS clone $snap $clone 61fi 62 63log_must $ZFS promote $clone 64 65# verify the 'promote' operation 66! snapexists $csnap && \ 67 log_fail "Snapshot $csnap doesn't exist after zfs promote." 68snapexists $snap && \ 69 log_fail "Snapshot $snap is still there after zfs promote." 70 71origin_prop=$(get_prop origin $vol) 72[[ "$origin_prop" != "$csnap" ]] && \ 73 log_fail "The dependency of $vol is not correct." 74origin_prop=$(get_prop origin $clone) 75[[ "$origin_prop" != "-" ]] && \ 76 log_fail "The dependency of $clone is not correct." 77 78log_pass "'zfs promote' can promote volume clone as expected." 79 80