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 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
32 . $STF_SUITE/include/libtest.shlib
33 . $STF_SUITE/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib
37 # 'zfs rename' should fail when the dataset are not within the same pool
40 # 1. Given a file system, snapshot and volume.
41 # 2. Rename each dataset object to a different pool.
42 # 3. Verify the operation fails, and only the original name
43 # is displayed by zfs list.
46 verify_runnable "global"
50 poolexists $TESTPOOL1 && \
51 destroy_pool $TESTPOOL1
52 [[ -e $TESTDIR/$TESTFILE1 ]] && \
53 log_must rm -f $TESTDIR/$TESTFILE1
58 "$TESTPOOL/$TESTFS1" "$TESTPOOL/$TESTCTR1" \
59 "$TESTPOOL/$TESTCTR/$TESTFS1" "$TESTPOOL/$TESTVOL" \
60 "$TESTPOOL/$TESTFS@snapshot" "$TESTPOOL/$TESTFS-clone"
63 # cleanup defined in zfs_rename.kshlib
67 log_assert "'zfs rename' should fail while datasets are within different pool."
71 log_must mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1
72 create_pool $TESTPOOL1 $TESTDIR/$TESTFILE1
74 for src in ${src_dataset[@]} ; do
75 dest=${src#$TESTPOOL/}
76 if [[ $dest == *"@"* ]]; then
78 dest=${TESTPOOL1}@$dest
80 dest=${TESTPOOL1}/$dest
82 log_mustnot zfs rename $src $dest
83 log_mustnot zfs rename -p $src $dest
86 # Verify original dataset name still in use
88 log_must datasetexists $src
91 log_pass "'zfs rename' fail while datasets are within different pool."