1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 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 8# 1.0 of the CDDL. 9# 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. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright (c) 2018 Datto Inc. 19# 20 21. $STF_SUITE/include/libtest.shlib 22 23# 24# DESCRIPTION: 25# zfs rename should rename datasets even for mountpoint=none children 26# 27# STRATEGY: 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 31# 32 33verify_runnable "both" 34 35function rename_cleanup 36{ 37 zfs destroy -fR $TESTPOOL/rename_test 38 zfs destroy -fR $TESTPOOL/renamed 39} 40 41log_onexit rename_cleanup 42 43 44log_must zfs create $TESTPOOL/rename_test 45log_must zfs create $TESTPOOL/rename_test/ds 46log_must zfs create -o mountpoint=none $TESTPOOL/rename_test/child 47log_must zfs create $TESTPOOL/rename_test/child/grandchild 48 49if ! ismounted $TESTPOOL/rename_test; then 50 log_fail "$TESTPOOL/rename_test is not mounted" 51fi 52if ! ismounted $TESTPOOL/rename_test/ds; then 53 log_fail "$TESTPOOL/rename_test/ds is not mounted" 54fi 55if ismounted $TESTPOOL/rename_test/child; then 56 log_fail "$TESTPOOL/rename_test/child is mounted" 57fi 58if ismounted $TESTPOOL/rename_test/child/grandchild; then 59 log_fail "$TESTPOOL/rename_test/child/grandchild is mounted" 60fi 61 62log_must zfs rename $TESTPOOL/rename_test $TESTPOOL/renamed 63 64log_mustnot zfs list $TESTPOOL/rename_test 65log_mustnot zfs list $TESTPOOL/rename_test/ds 66log_mustnot zfs list $TESTPOOL/rename_test/child 67log_mustnot zfs list $TESTPOOL/rename_test/child/grandchild 68 69log_must zfs list $TESTPOOL/renamed 70log_must zfs list $TESTPOOL/renamed/ds 71log_must zfs list $TESTPOOL/renamed/child 72log_must zfs list $TESTPOOL/renamed/child/grandchild 73 74if ! ismounted $TESTPOOL/renamed; then 75 log_must zfs get all $TESTPOOL/renamed 76 log_fail "$TESTPOOL/renamed is not mounted" 77fi 78if ! ismounted $TESTPOOL/renamed/ds; then 79 log_fail "$TESTPOOL/renamed/ds is not mounted" 80fi 81if ismounted $TESTPOOL/renamed/child; then 82 log_fail "$TESTPOOL/renamed/child is mounted" 83fi 84if ismounted $TESTPOOL/renamed/child/grandchild; then 85 log_fail "$TESTPOOL/renamed/child/grandchild is mounted" 86fi 87 88log_pass "Verified rename for mountpoint=none children." 89