]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_promote/zfs_promote_008_pos.ksh
05d482c405387a003036cb883c77ab2167d17919
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) 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
36 # 'zfs promote' can successfully promote a volume clone.
39 # 1. Create a volume clone
40 # 2. Promote the volume clone
41 # 3. Verify the dependency changed.
44 verify_runnable
"global"
48 if snapexists
$csnap; then
49 log_must zfs promote
$vol
52 log_must zfs destroy
-rR $snap
55 log_assert
"'zfs promote' can promote a volume clone."
58 vol
=$TESTPOOL/$TESTVOL
60 clone
=$TESTPOOL/volclone
61 csnap
=$clone@
$TESTSNAP
63 if ! snapexists
$snap ; then
64 log_must zfs snapshot
$snap
65 log_must zfs clone
$snap $clone
68 log_must zfs promote
$clone
70 # verify the 'promote' operation
71 ! snapexists
$csnap && \
72 log_fail
"Snapshot $csnap doesn't exist after zfs promote."
74 log_fail
"Snapshot $snap is still there after zfs promote."
76 origin_prop
=$
(get_prop origin
$vol)
77 [[ "$origin_prop" != "$csnap" ]] && \
78 log_fail
"The dependency of $vol is not correct."
79 origin_prop
=$
(get_prop origin
$clone)
80 [[ "$origin_prop" != "-" ]] && \
81 log_fail
"The dependency of $clone is not correct."
83 log_pass
"'zfs promote' can promote volume clone as expected."