]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/snapshot/snapshot_012_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 2008 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 'snapshot -r' can create snapshot for promoted clone, and vice
38 # versa, a clone filesystem from the snapshot created by 'snapshot -r'
39 # can be correctly promoted.
42 # 1. Create a dataset tree
43 # 2. snapshot a filesystem and clone the snapshot
44 # 3. promote the clone
45 # 4. snapshot -r the dataset tree
46 # 5. verify that the snapshot of cloned filesystem is created correctly
47 # 6. clone a snapshot from the snapshot tree
48 # 7. promote the clone
49 # 8. verify that the clone is promoted correctly.
52 verify_runnable
"both"
56 if datasetexists
$clone1; then
57 log_must zfs promote
$ctrfs
58 log_must zfs destroy
$clone1
61 snapexists
$snapctr && \
62 log_must zfs destroy
-r $snapctr
64 if snapexists
$clone@
$TESTSNAP1; then
65 log_must zfs promote
$ctrfs
66 log_must zfs destroy
-rR $ctrfs@
$TESTSNAP1
70 log_assert
"Verify that 'snapshot -r' can work with 'zfs promote'."
73 ctr
=$TESTPOOL/$TESTCTR
76 clone1
=$ctr/$TESTCLONE1
79 snapctr
=$ctr@
$TESTSNAP
80 snapctrclone
=$clone@
$TESTSNAP
81 snapctrclone1
=$clone1@
$TESTSNAP
84 #preparation for testing
85 log_must zfs snapshot
$ctrfs@
$TESTSNAP1
86 log_must zfs clone
$ctrfs@
$TESTSNAP1 $clone
87 log_must zfs promote
$clone
89 log_must zfs snapshot
-r $snapctr
91 ! snapexists
$snapctrclone && \
92 log_fail
"'snapshot -r' fails to create $snapctrclone for $ctr/$TESTCLONE."
94 log_must zfs clone
$snapctrfs $clone1
95 log_must zfs promote
$clone1
97 #verify the origin value is correct.
98 orig_value
=$
(get_prop origin
$ctrfs)
99 if ! snapexists
$snapctrclone1 ||
[[ "$orig_value" != "$snapctrclone1" ]]; then
100 log_fail
"'zfs promote' fails to promote $clone which is cloned from \
104 log_pass
"'snapshot -r' can work with 'zfs promote' as expected."