1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
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.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27
28#
29# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30#
31
32. $STF_SUITE/tests/functional/history/history_common.kshlib
33. $STF_SUITE/include/libtest.shlib
34
35#
36# DESCRIPTION:
37#	Verify the following zfs subcommands are not logged.
38#	list, get, holds, mount, unmount, share, unshare, send
39#
40# STRATEGY:
41#	1. Create a test pool.
42#	2. Separately invoke zfs list|get|holds|mount|unmount|share|unshare|send
43#	3. Verify they were not recored in pool history.
44#
45
46verify_runnable "global"
47
48function cleanup
49{
50	if datasetexists $fs ; then
51		log_must zfs destroy -rf $fs
52	fi
53	log_must zfs create $fs
54}
55
56log_assert "Verify 'zfs list|get|holds|mount|unmount|share|unshare|send' " \
57    "will not be logged."
58log_onexit cleanup
59
60# Create initial test environment
61fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2
62log_must zfs set sharenfs=on $fs
63log_must zfs snapshot $snap1
64log_must zfs hold tag $snap1
65log_must zfs snapshot $snap2
66
67# Save initial TESTPOOL history
68log_must eval "zpool history $TESTPOOL > $OLD_HISTORY"
69
70log_must zfs list $fs > /dev/null
71log_must zfs get mountpoint $fs > /dev/null
72log_must zfs unmount $fs
73log_must zfs mount $fs
74log_must zfs share $fs
75log_must zfs unshare $fs
76log_must zfs send -i $snap1 $snap2 > /dev/null
77log_must zfs holds $snap1
78
79log_must eval "zpool history $TESTPOOL > $NEW_HISTORY"
80log_must diff $OLD_HISTORY $NEW_HISTORY
81
82log_must zfs release tag $snap1
83
84log_pass "Verify 'zfs list|get|mount|unmount|share|unshare|send' passed."
85