5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
21 .
$STF_SUITE/include
/libtest.shlib
22 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_destroy
/zfs_destroy.cfg
26 # 'zfs destroy -R <snapshot>' can destroy all the child
27 # snapshots and preserves all the nested datasetss.
30 # 1. Create nested datasets in the storage pool.
31 # 2. Create recursive snapshots for all the nested datasets.
32 # 3. Verify when snapshots are destroyed recursively, all
33 # the nested datasets still exist.
36 verify_runnable
"both"
38 log_assert
"Verify 'zfs destroy -R <snapshot>' does not destroy" \
42 datasets
="$TESTPOOL/$TESTFS1 $TESTPOOL/$TESTFS1/$TESTFS2
43 $TESTPOOL/$TESTFS1/$TESTFS2/$TESTFS3"
47 for ds
in $datasets; do
48 datasetexists
$ds && zfs destroy
-rf $ds
52 # create nested datasets
53 log_must zfs create
-p $TESTPOOL/$TESTFS1/$TESTFS2/$TESTFS3
55 # verify dataset creation
56 for ds
in $datasets; do
57 datasetexists
$ds || log_fail
"Create $ds dataset fail."
60 # create recursive nestedd snapshot
61 log_must zfs snapshot
-r $TESTPOOL/$TESTFS1@snap
62 for ds
in $datasets; do
63 datasetexists
$ds@snap || log_fail
"Create $ds@snap snapshot fail."
66 # destroy nested snapshot recursively
67 log_must zfs destroy
-R $TESTPOOL/$TESTFS1@snap
69 # verify snapshot destroy
70 for ds
in $datasets; do
71 datasetexists
$ds@snap
&& log_fail
"$ds@snap exists. Destroy failed!"
74 # verify nested datasets still exist
75 for ds
in $datasets; do
76 datasetexists
$ds || log_fail
"Recursive snapshot destroy deleted $ds"
79 log_pass
"'zfs destroy -R <snapshot>' works as expected."