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 is of the CDDL is also available via the Internet
12 # at http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2018 Datto Inc.
21 . $STF_SUITE/include/libtest.shlib
25 # zfs rename should rename datasets even for mountpoint=none children
28 # 1. Create a set of nested datasets with mountpoint=none
29 # 2. Verify datasets aren't mounted except for the parent
30 # 3. Rename mountpoint and verify all child datasets are renamed
33 verify_runnable "both"
35 function rename_cleanup
37 log_note zfs destroy -fR $TESTPOOL/rename_test
38 log_note zfs destroy -fR $TESTPOOL/renamed
41 log_onexit rename_cleanup
44 log_must zfs create $TESTPOOL/rename_test
45 log_must zfs create $TESTPOOL/rename_test/ds
46 log_must zfs create -o mountpoint=none $TESTPOOL/rename_test/child
47 log_must zfs create $TESTPOOL/rename_test/child/grandchild
49 if ! ismounted $TESTPOOL/rename_test; then
50 log_fail "$TESTPOOL/rename_test is not mounted"
52 if ! ismounted $TESTPOOL/rename_test/ds; then
53 log_fail "$TESTPOOL/rename_test/ds is not mounted"
55 if ismounted $TESTPOOL/rename_test/child; then
56 log_fail "$TESTPOOL/rename_test/child is mounted"
58 if ismounted $TESTPOOL/rename_test/child/grandchild; then
59 log_fail "$TESTPOOL/rename_test/child/grandchild is mounted"
62 log_must zfs rename $TESTPOOL/rename_test $TESTPOOL/renamed
64 log_mustnot zfs list $TESTPOOL/rename_test
65 log_mustnot zfs list $TESTPOOL/rename_test/ds
66 log_mustnot zfs list $TESTPOOL/rename_test/child
67 log_mustnot zfs list $TESTPOOL/rename_test/child/grandchild
69 log_must zfs list $TESTPOOL/renamed
70 log_must zfs list $TESTPOOL/renamed/ds
71 log_must zfs list $TESTPOOL/renamed/child
72 log_must zfs list $TESTPOOL/renamed/child/grandchild
74 if ! ismounted $TESTPOOL/renamed; then
75 log_must zfs get all $TESTPOOL/renamed
76 log_fail "$TESTPOOL/renamed is not mounted"
78 if ! ismounted $TESTPOOL/renamed/ds; then
79 log_fail "$TESTPOOL/renamed/ds is not mounted"
81 if ismounted $TESTPOOL/renamed/child; then
82 log_fail "$TESTPOOL/renamed/child is mounted"
84 if ismounted $TESTPOOL/renamed/child/grandchild; then
85 log_fail "$TESTPOOL/renamed/child/grandchild is mounted"
88 log_pass "Verified rename for mountpoint=none children."