]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/snapshot/snapshot_010_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) 2013, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
33 .
$STF_SUITE/tests
/functional
/snapshot
/snapshot.cfg
37 # Verify 'destroy -r' can correctly destroy a snapshot tree at any point.
40 # 1. Use the snapshot -r to create snapshot for top level pool
41 # 2. Select a middle point of the snapshot tree, use destroy -r to destroy all
42 # snapshots beneath the point.
43 # 3. Verify the destroy results.
46 verify_runnable
"both"
52 datasetexists
$ctrvol && \
53 log_must zfs destroy
-f $ctrvol
55 for snap
in $ctrfs@
$TESTSNAP1 \
56 $snappool $snapvol $snapctr $snapctrvol \
57 $snapctrclone $snapctrfs
60 log_must zfs destroy
-rf $snap
65 log_assert
"Verify 'destroy -r' can correctly destroy a snapshot subtree at any point."
68 ctr
=$TESTPOOL/$TESTCTR
73 snapctr
=$ctr@
$TESTSNAP
75 snapctrvol
=$ctr/$TESTVOL1@
$TESTSNAP
76 snapctrclone
=$ctr/$TESTCLONE@
$TESTSNAP
79 #preparation for testing
80 log_must zfs snapshot
$ctrfs@
$TESTSNAP1
81 if is_global_zone
; then
82 log_must zfs create
-V $VOLSIZE $ctrvol
84 log_must zfs create
$ctrvol
87 log_must zfs snapshot
-r $snappool
89 #select the $TESTCTR as destroy point, $TESTCTR is a child of $TESTPOOL
90 log_must zfs destroy
-r $snapctr
91 for snap
in $snapctr $snapctrvol $snapctrclone $snapctrfs; do
93 log_fail
"The snapshot $snap is not destroyed correctly."
96 for snap
in $snappool $snapfs $snapvol $ctrfs@
$TESTSNAP1;do
97 ! snapexists
$snap && \
98 log_fail
"The snapshot $snap should be not destroyed."
101 log_pass
"'destroy -r' destroys snapshot subtree as expected."