Print this page
2605 want to resume interrupted zfs send
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Xin Li <delphij@freebsd.org>
Reviewed by: Arne Jansen <sensille@gmx.net>
Approved by: Dan McDonald <danmcd@omniti.com>
4206 history_003_pos relies on exact size of history log and entries
4207 history_008_pos depends on obsolete internal history log message
4208 Typo in zfs_main.c: "posxiuser"
4209 Populate zfstest with the remainder of the STF tests
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib
+++ new/usr/src/test/zfs-tests/tests/functional/rsend/rsend.kshlib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 26
27 27 #
28 28 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
29 29 #
30 30
31 31 . $STF_SUITE/include/libtest.shlib
32 32 . $STF_SUITE/include/math.shlib
33 33 . $STF_SUITE/tests/functional/rsend/rsend.cfg
34 34
35 35 #
36 36 # Set up test model which includes various datasets
37 37 #
38 38 # @final
39 39 # @snapB
40 40 # @init
41 41 # |
42 42 # ______ pclone
43 43 # | /
44 44 # |@psnap
45 45 # || @final
46 46 # ||@final @final @snapC
47 47 # ||@snapC @snapC @snapB
48 48 # ||@snapA @snapB @snapA
49 49 # ||@init @init @init
50 50 # ||| | |
51 51 # $pool -------- $FS ------- fs1 ------- fs2
52 52 # \ \\_____ \ |
53 53 # vol vol \____ \ @fsnap
54 54 # | | \ \ \
55 55 # @init @vsnap | ------------ fclone
56 56 # @snapA @init \ | |
57 57 # @final @snapB \ | @init
58 58 # @snapC vclone @snapA
59 59 # @final | @final
60 60 # @init
61 61 # @snapC
62 62 # @final
63 63 #
64 64 # $1 pool name
65 65 #
66 66 function setup_test_model
67 67 {
68 68 typeset pool=$1
69 69
70 70 log_must zfs create -p $pool/$FS/fs1/fs2
71 71
72 72 log_must zfs snapshot $pool@psnap
73 73 log_must zfs clone $pool@psnap $pool/pclone
74 74
75 75 if is_global_zone ; then
76 76 log_must zfs create -V 16M $pool/vol
77 77 log_must zfs create -V 16M $pool/$FS/vol
78 78
79 79 log_must zfs snapshot $pool/$FS/vol@vsnap
80 80 log_must zfs clone $pool/$FS/vol@vsnap $pool/$FS/vclone
81 81 fi
82 82
83 83 log_must snapshot_tree $pool/$FS/fs1/fs2@fsnap
84 84 log_must zfs clone $pool/$FS/fs1/fs2@fsnap $pool/$FS/fs1/fclone
85 85 log_must zfs snapshot -r $pool@init
86 86
87 87 log_must snapshot_tree $pool@snapA
88 88 log_must snapshot_tree $pool@snapC
89 89 log_must snapshot_tree $pool/pclone@snapB
90 90 log_must snapshot_tree $pool/$FS@snapB
91 91 log_must snapshot_tree $pool/$FS@snapC
92 92 log_must snapshot_tree $pool/$FS/fs1@snapA
93 93 log_must snapshot_tree $pool/$FS/fs1@snapB
94 94 log_must snapshot_tree $pool/$FS/fs1@snapC
95 95 log_must snapshot_tree $pool/$FS/fs1/fclone@snapA
96 96
97 97 if is_global_zone ; then
98 98 log_must zfs snapshot $pool/vol@snapA
99 99 log_must zfs snapshot $pool/$FS/vol@snapB
100 100 log_must zfs snapshot $pool/$FS/vol@snapC
101 101 log_must zfs snapshot $pool/$FS/vclone@snapC
102 102 fi
103 103
104 104 log_must zfs snapshot -r $pool@final
105 105
106 106 return 0
107 107 }
108 108
109 109 #
110 110 # Cleanup the BACKDIR and given pool content and all the sub datasets
111 111 #
112 112 # $1 pool name
113 113 #
114 114 function cleanup_pool
115 115 {
116 116 typeset pool=$1
117 117 log_must rm -rf $BACKDIR/*
118 118
119 119 if is_global_zone ; then
120 120 log_must zfs destroy -Rf $pool
121 121 else
122 122 typeset list=$(zfs list -H -r -t all -o name $pool)
123 123 for ds in $list ; do
124 124 if [[ $ds != $pool ]] ; then
125 125 if datasetexists $ds ; then
126 126 log_must zfs destroy -Rf $ds
127 127 fi
128 128 fi
129 129 done
130 130 fi
131 131
132 132 typeset mntpnt=$(get_prop mountpoint $pool)
133 133 if ! ismounted $pool ; then
134 134 # Make sure mountpoint directory is empty
135 135 if [[ -d $mntpnt ]]; then
136 136 log_must rm -rf $mntpnt/*
137 137 fi
138 138
139 139 log_must zfs mount $pool
140 140 fi
141 141 if [[ -d $mntpnt ]]; then
142 142 rm -rf $mntpnt/*
143 143 fi
144 144
145 145 return 0
146 146 }
147 147
148 148 function cleanup_pools
149 149 {
150 150 cleanup_pool $POOL2
151 151 destroy_pool $POOL3
152 152 }
153 153
154 154 #
155 155 # Detect if the given two filesystems have same sub-datasets
156 156 #
157 157 # $1 source filesystem
158 158 # $2 destination filesystem
159 159 #
160 160 function cmp_ds_subs
161 161 {
162 162 typeset src_fs=$1
163 163 typeset dst_fs=$2
164 164
165 165 zfs list -r -H -t all -o name $src_fs > $BACKDIR/src1
166 166 zfs list -r -H -t all -o name $dst_fs > $BACKDIR/dst1
167 167
168 168 eval sed -e 's:^$src_fs:PREFIX:g' < $BACKDIR/src1 > $BACKDIR/src
169 169 eval sed -e 's:^$dst_fs:PREFIX:g' < $BACKDIR/dst1 > $BACKDIR/dst
170 170
171 171 diff $BACKDIR/src $BACKDIR/dst
172 172 typeset -i ret=$?
173 173
174 174 rm -f $BACKDIR/src $BACKDIR/dst $BACKDIR/src1 $BACKDIR/dst1
175 175
176 176 return $ret
177 177 }
178 178
179 179 #
180 180 # Compare all the directores and files in two filesystems
181 181 #
182 182 # $1 source filesystem
183 183 # $2 destination filesystem
184 184 #
185 185 function cmp_ds_cont
186 186 {
187 187 typeset src_fs=$1
188 188 typeset dst_fs=$2
189 189
190 190 typeset srcdir dstdir
191 191 srcdir=$(get_prop mountpoint $src_fs)
192 192 dstdir=$(get_prop mountpoint $dst_fs)
193 193
194 194 diff -r $srcdir $dstdir > /dev/null 2>&1
195 195 return $?
196 196 }
197 197
198 198 #
199 199 # Compare the given two dataset properties
200 200 #
201 201 # $1 dataset 1
202 202 # $2 dataset 2
203 203 #
204 204 function cmp_ds_prop
205 205 {
206 206 typeset dtst1=$1
207 207 typeset dtst2=$2
208 208
209 209 for item in "type" "origin" "volblocksize" "aclinherit" "aclmode" \
210 210 "atime" "canmount" "checksum" "compression" "copies" "devices" \
211 211 "exec" "quota" "readonly" "recordsize" "reservation" "setuid" \
212 212 "sharenfs" "snapdir" "version" "volsize" "xattr" "zoned" \
213 213 "mountpoint";
214 214 do
215 215 zfs get -H -o property,value,source $item $dtst1 >> \
216 216 $BACKDIR/dtst1
217 217 zfs get -H -o property,value,source $item $dtst2 >> \
218 218 $BACKDIR/dtst2
219 219 done
220 220
221 221 eval sed -e 's:$dtst1:PREFIX:g' < $BACKDIR/dtst1 > $BACKDIR/dtst1
222 222 eval sed -e 's:$dtst2:PREFIX:g' < $BACKDIR/dtst2 > $BACKDIR/dtst2
223 223
224 224 diff $BACKDIR/dtst1 $BACKDIR/dtst2
225 225 typeset -i ret=$?
226 226
227 227 rm -f $BACKDIR/dtst1 $BACKDIR/dtst2
228 228
229 229 return $ret
230 230
231 231 }
232 232
233 233 #
234 234 # Random create directories and files
235 235 #
236 236 # $1 directory
237 237 #
238 238 function random_tree
239 239 {
240 240 typeset dir=$1
241 241
242 242 if [[ -d $dir ]]; then
243 243 rm -rf $dir
244 244 fi
245 245 mkdir -p $dir
246 246 typeset -i ret=$?
247 247
248 248 typeset -i nl nd nf
249 249 ((nl = RANDOM % 6 + 1))
250 250 ((nd = RANDOM % 3 ))
251 251 ((nf = RANDOM % 5 ))
252 252 mktree -b $dir -l $nl -d $nd -f $nf
253 253 ((ret |= $?))
254 254
255 255 return $ret
256 256 }
257 257
258 258 #
259 259 # Put data in filesystem and take snapshot
260 260 #
261 261 # $1 snapshot name
262 262 #
263 263 function snapshot_tree
264 264 {
265 265 typeset snap=$1
266 266 typeset ds=${snap%%@*}
267 267 typeset type=$(get_prop "type" $ds)
268 268
269 269 typeset -i ret=0
270 270 if [[ $type == "filesystem" ]]; then
271 271 typeset mntpnt=$(get_prop mountpoint $ds)
272 272 ((ret |= $?))
273 273
274 274 if ((ret == 0)) ; then
275 275 eval random_tree $mntpnt/${snap##$ds}
276 276 ((ret |= $?))
277 277 fi
278 278 fi
279 279
280 280 if ((ret == 0)) ; then
281 281 zfs snapshot $snap
282 282 ((ret |= $?))
283 283 fi
284 284
285 285 return $ret
286 286 }
287 287
288 288 #
289 289 # Destroy the given snapshot and stuff
290 290 #
291 291 # $1 snapshot
292 292 #
293 293 function destroy_tree
294 294 {
295 295 typeset -i ret=0
296 296 typeset snap
297 297 for snap in "$@" ; do
298 298 zfs destroy $snap
299 299 ret=$?
300 300
301 301 typeset ds=${snap%%@*}
302 302 typeset type=$(get_prop "type" $ds)
303 303 if [[ $type == "filesystem" ]]; then
304 304 typeset mntpnt=$(get_prop mountpoint $ds)
305 305 ((ret |= $?))
306 306
307 307 if ((ret != 0)); then
308 308 rm -r $mntpnt/$snap
309 309 ((ret |= $?))
310 310 fi
311 311 fi
312 312
313 313 if ((ret != 0)); then
314 314 return $ret
315 315 fi
316 316 done
317 317
318 318 return 0
319 319 }
320 320
321 321 #
322 322 # Get all the sub-datasets of give dataset with specific suffix
323 323 #
324 324 # $1 Given dataset
325 325 # $2 Suffix
326 326 #
327 327 function getds_with_suffix
328 328 {
329 329 typeset ds=$1
330 330 typeset suffix=$2
331 331
332 332 typeset list=$(zfs list -r -H -t all -o name $ds | grep "$suffix$")
333 333
334 334 echo $list
335 335 }
336 336
337 337 #
338 338 # Output inherited properties whitch is edited for file system
339 339 #
340 340 function fs_inherit_prop
341 341 {
342 342 typeset fs_prop
343 343 if is_global_zone ; then
344 344 fs_prop=$(zfs inherit 2>&1 | \
345 345 awk '$2=="YES" && $3=="YES" {print $1}')
346 346 if ! is_te_enabled ; then
347 347 fs_prop=$(echo $fs_prop | grep -v "mlslabel")
348 348 fi
349 349 else
350 350 fs_prop=$(zfs inherit 2>&1 | \
351 351 awk '$2=="YES" && $3=="YES" {print $1}'|
352 352 egrep -v "devices|mlslabel|sharenfs|sharesmb|zoned")
353 353 fi
354 354
355 355 echo $fs_prop
356 356 }
357 357
358 358 #
359 359 # Output inherited properties for volume
360 360 #
361 361 function vol_inherit_prop
362 362 {
363 363 echo "checksum readonly"
364 364 }
365 365
366 366 #
367 367 # Get the destination dataset to compare
368 368 #
369 369 function get_dst_ds
370 370 {
371 371 typeset srcfs=$1
372 372 typeset dstfs=$2
373 373
374 374 #
375 375 # If the srcfs is not pool
376 376 #
377 377 if ! zpool list $srcfs > /dev/null 2>&1 ; then
378 378 eval dstfs="$dstfs/${srcfs#*/}"
379 379 fi
380 380
381 381 echo $dstfs
382 382 }
383 383
384 384 #
385 385 # Make test files
386 386 #
387 387 # $1 Number of files to create
388 388 # $2 Maximum file size
389 389 # $3 File ID offset
390 390 # $4 File system to create the files on
391 391 #
392 392 function mk_files
393 393 {
394 394 nfiles=$1
395 395 maxsize=$2
396 396 file_id_offset=$3
397 397 fs=$4
398 398
399 399 for ((i=0; i<$nfiles; i=i+1)); do
400 400 dd if=/dev/urandom \
401 401 of=/$fs/file-$maxsize-$((i+$file_id_offset)) \
402 402 bs=$(($RANDOM * $RANDOM % $maxsize)) \
403 403 count=1 >/dev/null 2>&1 || log_fail \
404 404 "Failed to create /$fs/file-$maxsize-$((i+$file_id_offset))"
405 405 done
406 406 echo Created $nfiles files of random sizes up to $maxsize bytes
407 407 }
408 408
409 409 #
410 410 # Remove test files
411 411 #
412 412 # $1 Number of files to remove
413 413 # $2 Maximum file size
414 414 # $3 File ID offset
415 415 # $4 File system to remove the files from
416 416 #
417 417 function rm_files
418 418 {
419 419 nfiles=$1
420 420 maxsize=$2
421 421 file_id_offset=$3
422 422 fs=$4
423 423
424 424 for ((i=0; i<$nfiles; i=i+1)); do
425 425 rm -f /$fs/file-$maxsize-$((i+$file_id_offset))
426 426 done
427 427 echo Removed $nfiles files of random sizes up to $maxsize bytes
428 428 }
429 429
430 430 #
431 431 # Mess up file contents
432 432 #
433 433 # $1 The file path
434 434 #
435 435 function mess_file
436 436 {
437 437 file=$1
438 438
439 439 filesize=$(stat -c '%s' $file)
440 440 offset=$(($RANDOM * $RANDOM % $filesize))
441 441 if (($RANDOM % 7 <= 1)); then
442 442 #
443 443 # We corrupt 2 bytes to minimize the chance that we
444 444 # write the same value that's already there.
445 445 #
446 446 log_must eval "dd if=/dev/random of=$file conv=notrunc " \
447 447 "bs=1 count=2 oseek=$offset >/dev/null 2>&1"
448 448 else
449 449 log_must truncate -s $offset $file
450 450 fi
451 451 }
452 452
453 453 #
454 454 # Diff the send/receive filesystems
455 455 #
456 456 # $1 The sent filesystem
457 457 # $2 The received filesystem
458 458 #
459 459 function file_check
460 460 {
461 461 sendfs=$1
462 462 recvfs=$2
463 463
464 464 if [[ -d /$recvfs/.zfs/snapshot/a && -d \
465 465 /$sendfs/.zfs/snapshot/a ]]; then
466 466 diff -r /$recvfs/.zfs/snapshot/a /$sendfs/.zfs/snapshot/a
467 467 [[ $? -eq 0 ]] || log_fail "Differences found in snap a"
468 468 fi
469 469 if [[ -d /$recvfs/.zfs/snapshot/b && -d \
470 470 /$sendfs/.zfs/snapshot/b ]]; then
471 471 diff -r /$recvfs/.zfs/snapshot/b /$sendfs/.zfs/snapshot/b
472 472 [[ $? -eq 0 ]] || log_fail "Differences found in snap b"
473 473 fi
474 474 }
475 475
476 476 #
477 477 # Resume test helper
478 478 #
479 479 # $1 The ZFS send command
480 480 # $2 The filesystem where the streams are sent
481 481 # $3 The receive filesystem
482 482 #
483 483 function resume_test
484 484 {
485 485 sendcmd=$1
486 486 streamfs=$2
487 487 recvfs=$3
488 488
489 489 stream_num=1
490 490 log_must eval "$sendcmd >/$streamfs/$stream_num"
491 491
492 492 for ((i=0; i<2; i=i+1)); do
493 493 mess_file /$streamfs/$stream_num
494 494 log_mustnot zfs recv -suv $recvfs </$streamfs/$stream_num
495 495 stream_num=$((stream_num+1))
496 496
497 497 token=$(zfs get -Hp -o value receive_resume_token $recvfs)
498 498 log_must eval "zfs send -v -t $token >/$streamfs/$stream_num"
499 499 [[ -f /$streamfs/$stream_num ]] || \
500 500 log_fail "NO FILE /$streamfs/$stream_num"
501 501 done
502 502 log_must zfs recv -suv $recvfs </$streamfs/$stream_num
503 503 }
504 504
|
↓ open down ↓ |
504 lines elided |
↑ open up ↑ |
505 505 #
506 506 # Setup filesystems for the resumable send/receive tests
507 507 #
508 508 # $1 The "send" filesystem
509 509 # $2 The "recv" filesystem
510 510 #
511 511 function test_fs_setup
512 512 {
513 513 typeset sendfs=$1
514 514 typeset recvfs=$2
515 - typeset streamfs=$3
516 515 typeset sendpool=${sendfs%%/*}
517 516 typeset recvpool=${recvfs%%/*}
518 517
519 518 datasetexists $sendfs && log_must zfs destroy -r $sendpool
520 519 datasetexists $recvfs && log_must zfs destroy -r $recvpool
521 - datasetexists $streamfs && log_must zfs destroy -r $streamfs
522 520
523 521 if $(datasetexists $sendfs || zfs create -o compress=lz4 $sendfs); then
524 522 mk_files 1000 256 0 $sendfs &
525 523 mk_files 1000 131072 0 $sendfs &
526 524 mk_files 100 1048576 0 $sendfs &
527 525 mk_files 10 10485760 0 $sendfs &
528 526 mk_files 1 104857600 0 $sendfs &
529 527 log_must wait
530 528 log_must zfs snapshot $sendfs@a
531 529
532 530 rm_files 200 256 0 $sendfs &
533 531 rm_files 200 131072 0 $sendfs &
534 532 rm_files 20 1048576 0 $sendfs &
535 533 rm_files 2 10485760 0 $sendfs &
536 534 log_must wait
537 535
538 536 mk_files 400 256 0 $sendfs &
539 537 mk_files 400 131072 0 $sendfs &
|
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
540 538 mk_files 40 1048576 0 $sendfs &
541 539 mk_files 4 10485760 0 $sendfs &
542 540 log_must wait
543 541
544 542 log_must zfs snapshot $sendfs@b
545 543 log_must eval "zfs send -v $sendfs@a >/$sendpool/initial.zsend"
546 544 log_must eval "zfs send -v -i @a $sendfs@b " \
547 545 ">/$sendpool/incremental.zsend"
548 546 fi
549 547
550 - log_must zfs create -o compress=lz4 $streamfs
548 + if datasetexists $streamfs; then
549 + log_must zfs destroy -r $streamfs
550 + fi
551 + log_must zfs create -o compress=lz4 $sendpool/stream
551 552 }
552 553
553 554 #
554 555 # Check to see if the specified features are set in a send stream.
555 556 # The values for these features are found in uts/common/fs/zfs/sys/zfs_ioctl.h
556 557 #
557 558 # $1 The stream file
558 559 # $2-$n The flags expected in the stream
559 560 #
560 561 function stream_has_features
561 562 {
562 563 typeset file=$1
563 564 shift
564 565
565 566 [[ -f $file ]] || log_fail "Couldn't find file: $file"
566 567 typeset flags=$(cat $file | zstreamdump | awk '/features =/ {print $3}')
567 568 typeset -A feature
568 569 feature[dedup]="1"
569 570 feature[dedupprops]="2"
570 571 feature[sa_spill]="4"
571 572 feature[embed_data]="10000"
572 573 feature[lz4]="20000"
573 574 feature[mooch_byteswap]="40000"
574 575 feature[large_blocks]="80000"
575 576 feature[resuming]="100000"
576 577 feature[redacted]="200000"
577 578 feature[compressed]="400000"
578 579
579 580 typeset flag known derived=0
580 581 for flag in "$@"; do
581 582 known=${feature[$flag]}
582 583 [[ -z $known ]] && log_fail "Unknown feature: $flag"
583 584
584 585 derived=$(echo "$flags & ${feature[$flag]} = X" | mdb | sed 's/ //g')
585 586 [[ $derived = $known ]] || return 1
586 587 done
587 588
588 589 return 0
589 590 }
590 591
591 592 #
592 593 # Parse zstreamdump -v output. The output varies for each kind of record:
593 594 # BEGIN records are simply output as "BEGIN"
594 595 # END records are output as "END"
595 596 # OBJECT records become "OBJECT <object num>"
596 597 # FREEOBJECTS records become "FREEOBJECTS <startobj> <numobjs>"
597 598 # FREE records become "<record type> <start> <length>"
598 599 # WRITE records become:
599 600 # "<record type> <compression type> <start> <logical size> <compressed size>
600 601 # <data size>"
601 602 #
602 603 function parse_dump
603 604 {
604 605 sed '/^WRITE/{N;s/\n/ /;}' | grep "^[A-Z]" | awk '{
605 606 if ($1 == "BEGIN" || $1 == "END") print $1
606 607 if ($1 == "OBJECT") print $1" "$4
607 608 if ($1 == "FREEOBJECTS") print $1" "$4" "$7
608 609 if ($1 == "FREE") print $1" "$7" "$10
609 610 if ($1 == "WRITE") print $1" "$15" "$18" "$21" "$24" "$27}'
610 611 }
611 612
612 613 #
613 614 # Given a send stream, verify that the size of the stream matches what's
614 615 # expected based on the source or target dataset. If the stream is an
615 616 # incremental stream, subtract the size of the source snapshot before
616 617 # comparing. This function does not currently handle incremental streams
617 618 # that remove data.
618 619 #
619 620 # $1 The zstreamdump output file
620 621 # $2 The dataset to compare against
621 622 # This can be a source of a send or recv target (fs, not snapshot)
622 623 # $3 The percentage below which verification is deemed a failure
623 624 # $4 The source snapshot of an incremental send
624 625 #
625 626
626 627 function verify_stream_size
627 628 {
628 629 typeset stream=$1
629 630 typeset ds=$2
630 631 typeset percent=${3:-90}
631 632 typeset inc_src=$4
632 633
633 634 [[ -f $stream ]] || log_fail "No such file: $stream"
634 635 datasetexists $ds || log_fail "No such dataset: $ds"
635 636
636 637 typeset stream_size=$(cat $stream | zstreamdump | sed -n \
637 638 's/ Total write size = \(.*\) (0x.*)/\1/p')
638 639
639 640 typeset inc_size=0
640 641 if [[ -n $inc_src ]]; then
641 642 inc_size=$(get_prop lrefer $inc_src)
642 643 if stream_has_features $stream compressed; then
643 644 inc_size=$(get_prop refer $inc_src)
644 645 fi
645 646 fi
646 647
647 648 if stream_has_features $stream compressed; then
648 649 ds_size=$(get_prop refer $ds)
649 650 else
650 651 ds_size=$(get_prop lrefer $ds)
651 652 fi
652 653 ds_size=$((ds_size - inc_size))
|
↓ open down ↓ |
92 lines elided |
↑ open up ↑ |
653 654
654 655 within_percent $stream_size $ds_size $percent || log_fail \
655 656 "$stream_size $ds_size differed by too much"
656 657 }
657 658
658 659 # Cleanup function for tests involving resumable send
659 660 function resume_cleanup
660 661 {
661 662 typeset sendfs=$1
662 663 typeset streamfs=$2
663 - typeset sendpool=${sendfs%%/*}
664 664
665 665 datasetexists $sendfs && log_must zfs destroy -r $sendfs
666 666 datasetexists $streamfs && log_must zfs destroy -r $streamfs
667 667 cleanup_pool $POOL2
668 - rm -f /$sendpool/initial.zsend /$sendpool/incremental.zsend
668 + rm -f /$POOL/initial.zsend /$POOL/incremental.zsend
669 669 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX