mirror_zfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh
наб b1579689a9 tests: rsend/send-c_props: make it chooch
Original error:
23:47:40.59 SUCCESS: eval zfs receive -dFv testpool2 < /mnt/testroot/backdir-rsend/pool-final-p
23:47:40.61 1,23d0
23:47:40.61 < type      filesystem      -
23:47:40.61 < origin    POOL@psnap      -
23:47:40.61 < volblocksize      -       -
23:47:40.61 < acltype   nfsv4   inherited from POOL
23:47:40.61 < dnodesize legacy  inherited from POOL
23:47:40.61 < atime     off     local
23:47:40.61 < canmount  off     local
23:47:40.61 < checksum  off     local
23:47:40.61 < compression       off     local
23:47:40.61 < copies    3       local
23:47:40.61 < devices   off     local
23:47:40.61 < exec      off     local
23:47:40.61 < quota     none    default
23:47:40.61 < readonly  on      local
23:47:40.61 < recordsize        128K    local
23:47:40.61 < reservation       none    default
23:47:40.61 < setuid    off     local
23:47:40.61 < snapdir   hidden  local
23:47:40.61 < version   5       -
23:47:40.61 < volsize   -       -
23:47:40.61 < xattr     off     local
23:47:40.61 < mountpoint        /PREFIX inherited from POOL
23:47:40.61 < jailed    on      local
23:47:40.62 cannot open 'testpool2/pclone': dataset does not exist
23:47:40.62 ERROR: cmp_ds_prop testpool/pclone testpool2/pclone exited 1

So: (a) actually send all the datasets in -p mode and
    (b) drop origin for clones sent with -p:

00:38:05.46 SUCCESS: eval zfs receive -dFv testpool2 < /mnt/testroot/backdir-rsend/pool-final-p
00:38:05.48 2c2
00:38:05.48 < origin    POOL@psnap
00:38:05.48 ---
00:38:05.48 > origin    POOL
00:38:05.49 ERROR: cmp_ds_prop testpool/pclone testpool2/pclone nosource exited 1

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13250
Closes #13259
2022-04-01 18:01:16 -07:00

79 lines
2.1 KiB
Bash
Executable File

#!/bin/ksh -p
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2015 by Delphix. All rights reserved.
#
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
. $STF_SUITE/include/properties.shlib
#
# Description:
# Verify compressed send streams can still preserve properties
#
# Strategy:
# 1. Randomly modify the properties in the src pool
# 2. Send a full compressed stream with -p to preserve properties
# 3. Verify all the received properties match the source datasets
# 4. Repeat the process with -R instead of -p
#
verify_runnable "global"
function cleanup
{
destroy_pool $POOL
destroy_pool $POOL2
log_must zpool create $POOL $DISK1
log_must zpool create $POOL2 $DISK2
log_must setup_test_model $POOL
}
log_assert "Compressed send doesn't interfere with preservation of properties"
log_onexit cleanup
typeset -a datasets=("" "/pclone" "/$FS" "/$FS/fs1" "/$FS/fs1/fs2"
"/$FS/fs1/fclone" "/vol" "/$FS/vol")
typeset ds
for opt in "-p" "-R"; do
for ds in ${datasets[@]}; do
randomize_ds_props $POOL$ds
done
if [ $opt = "-p" ]; then
for ds in ${datasets[@]}; do
log_must eval "zfs send -c $opt $POOL$ds@final > $BACKDIR/pool-final$opt"
log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt"
done
else
log_must eval "zfs send -c $opt $POOL@final > $BACKDIR/pool-final$opt"
log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt"
fi
for ds in ${datasets[@]}; do
typeset origin=
if [ $opt = "-p" ] && [ ${ds/clone//} != $ds ]; then
origin=noorigin
fi
log_must cmp_ds_prop $POOL$ds $POOL2$ds nosource $origin
log_must cmp_ds_prop $POOL$ds@final $POOL2$ds@final
done
# Don't cleanup the second time, since we do that on exit anyway.
[ $opt = "-p" ] && cleanup
done
log_pass "Compressed send doesn't interfere with preservation of properties"