]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - zfs/tests/zfs-tests/tests/functional/cli_root/zfs_promote/zfs_promote_002_pos.ksh
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.
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.
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]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012 by Delphix. All rights reserved.
32 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_promote
/zfs_promote.cfg
33 .
$STF_SUITE/include
/libtest.shlib
37 # 'zfs promote' can deal with multiple snapshots in the origin filesystem.
40 # 1. Create multiple snapshots and a clone of the last snapshot
41 # 2. Promote the clone filesystem
42 # 3. Verify the promoted filesystem included all snapshots
45 verify_runnable
"both"
49 if snapexists
$csnap1; then
50 log_must
$ZFS promote
$fs
55 for ds
in $snap $snap1; do
56 log_must
$ZFS destroy
-rR $ds
58 for file in $TESTDIR/$TESTFILE0 $TESTDIR/$TESTFILE1; do
59 [[ -e $file ]] && $RM -f $file
63 log_assert
"'zfs promote' can deal with multiple snapshots in a filesystem."
69 clone
=$TESTPOOL/$TESTCLONE
70 csnap
=$clone@
$TESTSNAP
71 csnap1
=$clone@
$TESTSNAP1
73 # setup for promote testing
74 log_must
$MKFILE $FILESIZE $TESTDIR/$TESTFILE0
75 log_must
$ZFS snapshot
$snap
76 log_must
$MKFILE $FILESIZE $TESTDIR/$TESTFILE1
77 log_must
$RM -f $testdir/$TESTFILE0
78 log_must
$ZFS snapshot
$snap1
79 log_must
$ZFS clone
$snap1 $clone
80 log_must
$MKFILE $FILESIZE /$clone/$CLONEFILE
82 log_must
$ZFS promote
$clone
84 # verify the 'promote' operation
85 for ds
in $csnap $csnap1; do
87 log_fail
"Snapshot $ds doesn't exist after zfs promote."
89 for ds
in $snap $snap1; do
91 log_fail
"Snapshot $ds is still there after zfs promote."
94 origin_prop
=$
(get_prop origin
$fs)
95 [[ "$origin_prop" != "$csnap1" ]] && \
96 log_fail
"The dependency of $fs is not correct."
97 origin_prop
=$
(get_prop origin
$clone)
98 [[ "$origin_prop" != "-" ]] && \
99 log_fail
"The dependency of $clone is not correct."
101 log_pass
"'zfs promote' deal with multiple snapshots as expected."