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