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 a full ZFS send/receive with the source filesystem 249c3fd121SMatthew Ahrens# unmounted. 259c3fd121SMatthew Ahrens# 269c3fd121SMatthew Ahrens# Strategy: 279c3fd121SMatthew Ahrens# 1. Destroy the filesystem for the receive 289c3fd121SMatthew Ahrens# 2. Unmount the source filsesystem 299c3fd121SMatthew Ahrens# 3. Start a full ZFS send, redirect output to a file 309c3fd121SMatthew Ahrens# 4. Mess up the contents of the stream state file on disk 319c3fd121SMatthew Ahrens# 5. Try ZFS receive, which should fail with a checksum mismatch error 329c3fd121SMatthew Ahrens# 6. ZFS send to the stream state file again using the receive_resume_token 339c3fd121SMatthew Ahrens# 7. ZFS receieve and verify the receive completes successfully 349c3fd121SMatthew Ahrens# 359c3fd121SMatthew Ahrens 369c3fd121SMatthew Ahrensverify_runnable "both" 379c3fd121SMatthew Ahrens 389c3fd121SMatthew Ahrenslog_assert "Verify resumability of a full ZFS send/receive with the source " \ 399c3fd121SMatthew Ahrens "filesystem unmounted" 409c3fd121SMatthew Ahrens 419c3fd121SMatthew Ahrenssendfs=$POOL/sendfs 429c3fd121SMatthew Ahrensrecvfs=$POOL2/recvfs 439c3fd121SMatthew Ahrensstreamfs=$POOL/stream 449c3fd121SMatthew Ahrens 455602294fSDan Kimmellog_onexit resume_cleanup $sendfs $streamfs 465602294fSDan Kimmel 47*544132fcSloli10Ktest_fs_setup $sendfs $recvfs $streamfs 481d32ba66SJohn Wren Kennedylog_must zfs unmount $sendfs 491d32ba66SJohn Wren Kennedyresume_test "zfs send $sendfs" $streamfs $recvfs 509c3fd121SMatthew Ahrensfile_check $sendfs $recvfs 519c3fd121SMatthew Ahrens 529c3fd121SMatthew Ahrenslog_pass "Verify resumability of a full ZFS send/receive with the source " \ 539c3fd121SMatthew Ahrens "filesystem unmounted" 54