19c3fd121SMatthew Ahrens#!/usr/bin/ksh 29c3fd121SMatthew Ahrens 39c3fd121SMatthew Ahrens# 49c3fd121SMatthew Ahrens# This file and its contents are supplied under the terms of the 59c3fd121SMatthew Ahrens# Common Development and Distribution License ("CDDL"), version 1.0. 69c3fd121SMatthew Ahrens# You may only use this file in accordance with the terms of version 79c3fd121SMatthew Ahrens# 1.0 of the CDDL. 89c3fd121SMatthew Ahrens# 99c3fd121SMatthew Ahrens# A full copy of the text of the CDDL should have accompanied this 109c3fd121SMatthew Ahrens# source. A copy of the CDDL is also available via the Internet at 119c3fd121SMatthew Ahrens# http://www.illumos.org/license/CDDL. 129c3fd121SMatthew Ahrens# 139c3fd121SMatthew Ahrens 149c3fd121SMatthew Ahrens# 151d32ba66SJohn Wren Kennedy# Copyright (c) 2014, 2016 by Delphix. All rights reserved. 169c3fd121SMatthew Ahrens# 179c3fd121SMatthew Ahrens 189c3fd121SMatthew Ahrens. $STF_SUITE/include/libtest.shlib 199c3fd121SMatthew Ahrens. $STF_SUITE/tests/functional/rsend/rsend.kshlib 209c3fd121SMatthew Ahrens 219c3fd121SMatthew Ahrens# 229c3fd121SMatthew Ahrens# Description: 239c3fd121SMatthew Ahrens# Verify resumability of an incremental ZFS send/receive with ZFS bookmarks in 249c3fd121SMatthew Ahrens# the presence of a corrupted stream. 259c3fd121SMatthew Ahrens# 269c3fd121SMatthew Ahrens# Strategy: 279c3fd121SMatthew Ahrens# 1. Bookmark a ZFS snapshot 289c3fd121SMatthew Ahrens# 2. Destroy the ZFS sanpshot 299c3fd121SMatthew Ahrens# 3. Destroy the filesystem for the receive 309c3fd121SMatthew Ahrens# 4. Verify receive of the full send stream 319c3fd121SMatthew Ahrens# 5. Start an incremental ZFS send of the ZFS bookmark, redirect output to a 329c3fd121SMatthew Ahrens# file 339c3fd121SMatthew Ahrens# 6. Mess up the contents of the stream state file on disk 349c3fd121SMatthew Ahrens# 7. Try ZFS receive, which should fail with a checksum mismatch error 359c3fd121SMatthew Ahrens# 8. ZFS send to the stream state file again using the receive_resume_token 369c3fd121SMatthew Ahrens# 9. ZFS receieve and verify the receive completes successfully 379c3fd121SMatthew Ahrens# 389c3fd121SMatthew Ahrens 399c3fd121SMatthew Ahrensverify_runnable "both" 409c3fd121SMatthew Ahrens 419c3fd121SMatthew Ahrenslog_assert "Verify resumability of an incremental ZFS send/receive with ZFS " \ 429c3fd121SMatthew Ahrens "bookmarks" 439c3fd121SMatthew Ahrens 449c3fd121SMatthew Ahrenssendfs=$POOL/sendfs 459c3fd121SMatthew Ahrensrecvfs=$POOL2/recvfs 469c3fd121SMatthew Ahrensstreamfs=$POOL/stream 479c3fd121SMatthew Ahrens 485602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 495602294fSDan Kimmel 50*544132fcSloli10Ktest_fs_setup $sendfs $recvfs $streamfs 511d32ba66SJohn Wren Kennedylog_must zfs bookmark $sendfs@a $sendfs#bm_a 521d32ba66SJohn Wren Kennedylog_must zfs destroy $sendfs@a 531d32ba66SJohn Wren Kennedylog_must zfs receive -v $recvfs </$POOL/initial.zsend 541d32ba66SJohn Wren Kennedyresume_test "zfs send -i \#bm_a $sendfs@b" $streamfs $recvfs 551d32ba66SJohn Wren Kennedylog_must zfs destroy -r -f $sendfs 561d32ba66SJohn Wren Kennedylog_must zfs receive -v $sendfs </$POOL/initial.zsend 571d32ba66SJohn Wren Kennedylog_must zfs receive -v $sendfs </$POOL/incremental.zsend 589c3fd121SMatthew Ahrensfile_check $sendfs $recvfs 599c3fd121SMatthew Ahrens 609c3fd121SMatthew Ahrenslog_pass "Verify resumability of an incremental ZFS send/receive with ZFS " \ 619c3fd121SMatthew Ahrens "bookmarks" 62