1*9c3fd121SMatthew Ahrens#!/usr/bin/ksh 2*9c3fd121SMatthew Ahrens 3*9c3fd121SMatthew Ahrens# 4*9c3fd121SMatthew Ahrens# This file and its contents are supplied under the terms of the 5*9c3fd121SMatthew Ahrens# Common Development and Distribution License ("CDDL"), version 1.0. 6*9c3fd121SMatthew Ahrens# You may only use this file in accordance with the terms of version 7*9c3fd121SMatthew Ahrens# 1.0 of the CDDL. 8*9c3fd121SMatthew Ahrens# 9*9c3fd121SMatthew Ahrens# A full copy of the text of the CDDL should have accompanied this 10*9c3fd121SMatthew Ahrens# source. A copy of the CDDL is also available via the Internet at 11*9c3fd121SMatthew Ahrens# http://www.illumos.org/license/CDDL. 12*9c3fd121SMatthew Ahrens# 13*9c3fd121SMatthew Ahrens 14*9c3fd121SMatthew Ahrens# 15*9c3fd121SMatthew Ahrens# Copyright (c) 2014 by Delphix. All rights reserved. 16*9c3fd121SMatthew Ahrens# 17*9c3fd121SMatthew Ahrens 18*9c3fd121SMatthew Ahrens. $STF_SUITE/include/libtest.shlib 19*9c3fd121SMatthew Ahrens. $STF_SUITE/tests/functional/rsend/rsend.kshlib 20*9c3fd121SMatthew Ahrens 21*9c3fd121SMatthew Ahrens# 22*9c3fd121SMatthew Ahrens# Description: 23*9c3fd121SMatthew Ahrens# Verify resumability of an incremental ZFS send/receive with ZFS bookmarks in 24*9c3fd121SMatthew Ahrens# the presence of a corrupted stream. 25*9c3fd121SMatthew Ahrens# 26*9c3fd121SMatthew Ahrens# Strategy: 27*9c3fd121SMatthew Ahrens# 1. Bookmark a ZFS snapshot 28*9c3fd121SMatthew Ahrens# 2. Destroy the ZFS sanpshot 29*9c3fd121SMatthew Ahrens# 3. Destroy the filesystem for the receive 30*9c3fd121SMatthew Ahrens# 4. Verify receive of the full send stream 31*9c3fd121SMatthew Ahrens# 5. Start an incremental ZFS send of the ZFS bookmark, redirect output to a 32*9c3fd121SMatthew Ahrens# file 33*9c3fd121SMatthew Ahrens# 6. Mess up the contents of the stream state file on disk 34*9c3fd121SMatthew Ahrens# 7. Try ZFS receive, which should fail with a checksum mismatch error 35*9c3fd121SMatthew Ahrens# 8. ZFS send to the stream state file again using the receive_resume_token 36*9c3fd121SMatthew Ahrens# 9. ZFS receieve and verify the receive completes successfully 37*9c3fd121SMatthew Ahrens# 38*9c3fd121SMatthew Ahrens 39*9c3fd121SMatthew Ahrensverify_runnable "both" 40*9c3fd121SMatthew Ahrens 41*9c3fd121SMatthew Ahrenslog_assert "Verify resumability of an incremental ZFS send/receive with ZFS " \ 42*9c3fd121SMatthew Ahrens "bookmarks" 43*9c3fd121SMatthew Ahrenslog_onexit cleanup_pool $POOL2 44*9c3fd121SMatthew Ahrens 45*9c3fd121SMatthew Ahrenssendfs=$POOL/sendfs 46*9c3fd121SMatthew Ahrensrecvfs=$POOL2/recvfs 47*9c3fd121SMatthew Ahrensstreamfs=$POOL/stream 48*9c3fd121SMatthew Ahrens 49*9c3fd121SMatthew Ahrenstest_fs_setup $POOL $POOL2 50*9c3fd121SMatthew Ahrenslog_must $ZFS bookmark $sendfs@a $sendfs#bm_a 51*9c3fd121SMatthew Ahrenslog_must $ZFS destroy $sendfs@a 52*9c3fd121SMatthew Ahrenslog_must $ZFS receive -v $recvfs </$POOL/initial.zsend 53*9c3fd121SMatthew Ahrensresume_test "$ZFS send -i \#bm_a $sendfs@b" $streamfs $recvfs 54*9c3fd121SMatthew Ahrenslog_must $ZFS destroy -r -f $sendfs 55*9c3fd121SMatthew Ahrenslog_must $ZFS receive -v $sendfs </$POOL/initial.zsend 56*9c3fd121SMatthew Ahrenslog_must $ZFS receive -v $sendfs </$POOL/incremental.zsend 57*9c3fd121SMatthew Ahrensfile_check $sendfs $recvfs 58*9c3fd121SMatthew Ahrens 59*9c3fd121SMatthew Ahrenslog_pass "Verify resumability of an incremental ZFS send/receive with ZFS " \ 60*9c3fd121SMatthew Ahrens "bookmarks" 61