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 of the CDDL is also available via the Internet at 12# http://www.illumos.org/license/CDDL. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright 2016, loli10K. All rights reserved. 19# 20 21. $STF_SUITE/include/libtest.shlib 22. $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib 23 24# 25# DESCRIPTION: 26# Verify ZFS can receive custom properties on both filesystems and 27# snapshots from full and incremental streams. 28# 29# STRATEGY: 30# 1. Create a filesystem. 31# 2. Snapshot the filesystem. 32# 3. Set custom properties on both the fs and snapshots. 33# 4. Create different send streams with the properties. 34# 5. Receive the send streams and verify the properties. 35# 36 37verify_runnable "both" 38 39typeset streamfile_full=$TEST_BASE_DIR/streamfile_full.$$ 40typeset streamfile_incr=$TEST_BASE_DIR/streamfile_incr.$$ 41orig=$TESTPOOL/$TESTFS1 42dest=$TESTPOOL/$TESTFS2 43typeset user_prop=$(valid_user_property 8) 44typeset value=$(user_property_value 8) 45 46function cleanup 47{ 48 log_must rm $streamfile_full 49 log_must rm $streamfile_incr 50 log_must zfs destroy -rf $TESTPOOL/$TESTFS1 51 log_must zfs destroy -rf $TESTPOOL/$TESTFS2 52} 53 54log_assert "ZFS can receive custom properties." 55log_onexit cleanup 56 57# 1. Create a filesystem. 58log_must zfs create $orig 59 60# 2. Snapshot the filesystem. 61log_must zfs snapshot $orig@snap1 62log_must zfs snapshot $orig@snap2 63log_must zfs snapshot $orig@snap3 64 65# 3. Set custom properties on both the fs and snapshots. 66log_must eval "zfs set '$user_prop'='$value' $orig" 67log_must eval "zfs set '$user_prop:snap1'='$value:snap1' $orig@snap1" 68log_must eval "zfs set '$user_prop:snap2'='$value:snap2' $orig@snap2" 69log_must eval "zfs set '$user_prop:snap3'='$value:snap3' $orig@snap3" 70 71# 4. Create different send streams with the properties. 72log_must eval "zfs send -p $orig@snap1 > $streamfile_full" 73log_must eval "zfs send -p -I $orig@snap1 $orig@snap3 > $streamfile_incr" 74 75# 5. Receive the send streams and verify the properties. 76log_must eval "zfs recv $dest < $streamfile_full" 77log_must eval "check_user_prop $dest $user_prop '$value'" 78log_must eval "check_user_prop $dest@snap1 '$user_prop:snap1' '$value:snap1'" 79log_must eval "zfs recv $dest < $streamfile_incr" 80log_must eval "check_user_prop $dest@snap2 '$user_prop:snap2' '$value:snap2'" 81log_must eval "check_user_prop $dest@snap3 '$user_prop:snap3' '$value:snap3'" 82 83log_pass "ZFS can receive custom properties passed." 84