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 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 
  46 verify_runnable "global"
  47 
  48 function cleanup
  49 {
  50         if datasetexists $fs ; then
  51                 log_must $ZFS destroy -rf $fs
  52         fi
  53         log_must $ZFS create $fs
  54 }
  55 
  56 log_assert "Verify 'zfs list|get|holds|mount|unmount|share|unshare|send' " \
  57     "will not be logged."
  58 log_onexit cleanup
  59 
  60 # Create initial test environment
  61 fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2
  62 log_must $ZFS set sharenfs=on $fs
  63 log_must $ZFS snapshot $snap1
  64 log_must $ZFS hold tag $snap1
  65 log_must $ZFS snapshot $snap2
  66 
  67 # Save initial TESTPOOL history
  68 log_must eval "$ZPOOL history $TESTPOOL > $OLD_HISTORY"
  69 
  70 log_must $ZFS list $fs > /dev/null
  71 log_must $ZFS get mountpoint $fs > /dev/null
  72 log_must $ZFS unmount $fs
  73 log_must $ZFS mount $fs
  74 log_must $ZFS share $fs
  75 log_must $ZFS unshare $fs
  76 log_must $ZFS send -i $snap1 $snap2 > /dev/null
  77 log_must $ZFS holds $snap1
  78 
  79 log_must eval "$ZPOOL history $TESTPOOL > $NEW_HISTORY"
  80 log_must $DIFF $OLD_HISTORY $NEW_HISTORY
  81 
  82 log_must $ZFS release tag $snap1
  83 
  84 log_pass "Verify 'zfs list|get|mount|unmount|share|unshare|send' passed."