tests: rsend_012_pos: backup/restore in one invocation
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 #13259
This commit is contained in:
parent
9da14f3981
commit
f7cc8dddf7
|
@ -47,28 +47,21 @@ function edited_prop
|
|||
typeset behaviour=$1
|
||||
typeset ds=$2
|
||||
typeset backfile=$TESTDIR/edited_prop_$ds
|
||||
typeset te=0
|
||||
|
||||
case $behaviour in
|
||||
"get")
|
||||
is_te_enabled && te=1
|
||||
typeset props=$(zfs inherit 2>&1 | \
|
||||
awk '$2=="YES" && $1 !~ /^vol|\.\.\.$/ {print $1}')
|
||||
for item in $props ; do
|
||||
if [[ $item == "mlslabel" ]] && \
|
||||
! is_te_enabled ; then
|
||||
continue
|
||||
fi
|
||||
log_must eval "zfs get -H -o property,value $item $ds >> $backfile"
|
||||
done
|
||||
awk -v te=$te '$2=="YES" && $1 !~ /^vol|\.\.\.$/ && (te || $1 != "mlslabel") {printf("%s,", $1)}')
|
||||
log_must eval "zfs get -Ho property,value ${props%,} $ds >> $backfile"
|
||||
;;
|
||||
"set")
|
||||
if [[ ! -f $backfile ]] ; then
|
||||
log_fail "$ds need backup properties firstly."
|
||||
fi
|
||||
|
||||
typeset prop value
|
||||
while read -r prop value; do
|
||||
log_must zfs set "$prop=$value" "$ds"
|
||||
done < $backfile
|
||||
log_must zfs set $(tr '\t' '=' < $backfile) "$ds"
|
||||
;;
|
||||
*)
|
||||
log_fail "Unrecognized behaviour: $behaviour"
|
||||
|
|
Loading…
Reference in New Issue