rsend_022_pos.ksh revision 9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#!/usr/bin/ksh
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner# This file and its contents are supplied under the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Common Development and Distribution License ("CDDL"), version 1.0.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# You may only use this file in accordance with the terms of version
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# 1.0 of the CDDL.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# A full copy of the text of the CDDL should have accompanied this
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# source. A copy of the CDDL is also available via the Internet at
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# http://www.illumos.org/license/CDDL.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Copyright (c) 2014 by Delphix. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin. $STF_SUITE/include/libtest.shlib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin. $STF_SUITE/tests/functional/rsend/rsend.kshlib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Description:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Verify resumability of an incremental ZFS send/receive with ZFS bookmarks in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# the presence of a corrupted stream.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Strategy:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 1. Bookmark a ZFS snapshot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 2. Destroy the ZFS sanpshot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 3. Destroy the filesystem for the receive
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 4. Verify receive of the full send stream
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 5. Start an incremental ZFS send of the ZFS bookmark, redirect output to a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# file
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 6. Mess up the contents of the stream state file on disk
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 7. Try ZFS receive, which should fail with a checksum mismatch error
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 8. ZFS send to the stream state file again using the receive_resume_token
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# 9. ZFS receieve and verify the receive completes successfully
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinverify_runnable "both"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_assert "Verify resumability of an incremental ZFS send/receive with ZFS " \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin "bookmarks"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_onexit cleanup_pool $POOL2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsendfs=$POOL/sendfs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinrecvfs=$POOL2/recvfs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstreamfs=$POOL/stream
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintest_fs_setup $POOL $POOL2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS bookmark $sendfs@a $sendfs#bm_a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS destroy $sendfs@a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS receive -v $recvfs </$POOL/initial.zsend
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinresume_test "$ZFS send -i \#bm_a $sendfs@b" $streamfs $recvfs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS destroy -r -f $sendfs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS receive -v $sendfs </$POOL/initial.zsend
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_must $ZFS receive -v $sendfs </$POOL/incremental.zsend
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfile_check $sendfs $recvfs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlog_pass "Verify resumability of an incremental ZFS send/receive with ZFS " \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin "bookmarks"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin