From b1579689a9e863ecd178e0a363fd9629e281ad27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 23 Mar 2022 21:07:33 +0100 Subject: [PATCH] tests: rsend/send-c_props: make it chooch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: John Kennedy Reviewed-by: Ryan Moeller Signed-off-by: Ahelenia ZiemiaƄska Closes #13250 Closes #13259 --- .../tests/functional/rsend/rsend.kshlib | 10 +++++++--- .../tests/functional/rsend/send-c_props.ksh | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib index 6f04a6b7b..a18e69dba 100644 --- a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -207,14 +207,18 @@ function cmp_ds_cont # # $1 dataset 1 # $2 dataset 2 +# $3 -n == don't track property source +# $4 -n == don't track the origin property # function cmp_ds_prop { typeset dtst1=$1 typeset dtst2=$2 - typeset source=",source" - [ -n "$3" ] && source= - typeset props="type,origin,volblocksize,acltype,dnodesize" + typeset nosource=$3 + typeset noorigin=$4 + typeset source=",source"; [ -n "$nosource" ] && source= + typeset origin=",origin"; [ -n "$noorigin" ] && origin= + typeset props="type$origin,volblocksize,acltype,dnodesize" props+=",atime,canmount,checksum,compression,copies,devices" props+=",exec,quota,readonly,recordsize,reservation,setuid" props+=",snapdir,version,volsize,xattr,mountpoint" diff --git a/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh b/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh index 6e95c2c30..82a2eb91e 100755 --- a/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh @@ -52,16 +52,27 @@ for opt in "-p" "-R"; do randomize_ds_props $POOL$ds done - log_must eval "zfs send -c $opt $POOL@final > $BACKDIR/pool-final$opt" - log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final$opt" + 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 - log_must cmp_ds_prop $POOL$ds $POOL2$ds + 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 + [ $opt = "-p" ] && cleanup done log_pass "Compressed send doesn't interfere with preservation of properties"