1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or https://opensource.org/licenses/CDDL-1.0. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# 29# Copyright (c) 2013, 2016 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/tests/functional/rsend/rsend.kshlib 33 34# 35# DESCRIPTION: 36# zfs send -R -i send incremental from fs@init to fs@final. 37# 38# STRATEGY: 39# 1. Create a set of snapshots and fill with data. 40# 2. Create sub filesystems. 41# 3. Create final snapshot 42# 4. Verify zfs send -R -i will backup all the datasets which has 43# snapshot suffix @final 44# 45 46verify_runnable "both" 47 48log_assert "zfs send -R -i send incremental from fs@init to fs@final." 49log_onexit cleanup_pool $POOL2 50 51# 52# Duplicate POOL2 for testing 53# 54log_must eval "zfs send -R $POOL@final > $BACKDIR/pool-final-R" 55log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final-R" 56 57if is_global_zone ; then 58 # 59 # Testing send -R -i backup from pool 60 # 61 srclist=$(getds_with_suffix $POOL2 @final) 62 interlist="$srclist $(getds_with_suffix $POOL2 @snapC)" 63 interlist="$interlist $(getds_with_suffix $POOL2 @snapB)" 64 interlist="$interlist $(getds_with_suffix $POOL2 @snapA)" 65 66 log_must eval "zfs send -R -i @init $POOL2@final > " \ 67 "$BACKDIR/pool-init-final-iR" 68 log_must destroy_tree $interlist 69 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-init-final-iR" 70 71 # Get current datasets with suffix @final 72 dstlist=$(getds_with_suffix $POOL2 @final) 73 if [[ $srclist != $dstlist ]]; then 74 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)" 75 fi 76 log_must cmp_ds_cont $POOL $POOL2 77fi 78 79dstds=$(get_dst_ds $POOL $POOL2) 80# 81# Testing send -R -i backup from filesystem 82# 83log_must eval "zfs send -R -i @init $dstds/$FS@final > " \ 84 "$BACKDIR/fs-init-final-iR" 85 86srclist=$(getds_with_suffix $dstds/$FS @final) 87interlist="$srclist $(getds_with_suffix $dstds/$FS @snapC)" 88interlist="$interlist $(getds_with_suffix $dstds/$FS @snapB)" 89interlist="$interlist $(getds_with_suffix $dstds/$FS @snapA)" 90log_must destroy_tree $interlist 91if is_global_zone ; then 92 log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-init-final-iR" 93else 94 zfs receive -F -d $dstds/$FS < $BACKDIR/fs-init-final-iR 95fi 96 97dstlist=$(getds_with_suffix $dstds/$FS @final) 98if [[ $srclist != $dstlist ]]; then 99 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)" 100fi 101log_must cmp_ds_cont $POOL $POOL2 102 103if is_global_zone ; then 104 # 105 # Testing send -R -i backup from volume 106 # 107 srclist=$(getds_with_suffix $POOL2/$FS/vol @final) 108 log_must eval "zfs send -R -i @init $POOL2/$FS/vol@final > " \ 109 "$BACKDIR/vol-init-final-iR" 110 log_must destroy_tree $srclist 111 log_must eval "zfs receive -d $POOL2 < $BACKDIR/vol-init-final-iR" 112 113 dstlist=$(getds_with_suffix $POOL2/$FS/vol @final) 114 if [[ $srclist != $dstlist ]]; then 115 log_fail "Unexpected: srclist($srclist) != dstlist($dstlist)" 116 fi 117 log_must cmp_ds_cont $POOL $POOL2 118fi 119 120log_pass "zfs send -R -i send incremental from fs@init to fs@final." 121