zfs_send_006_pos.ksh revision 1d32ba663e202c24a5a1f2e5aef83fffb447cb7f
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
#
# CDDL HEADER END
#
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# Verify 'zfs send' can generate valid streams with different options
#
# STRATEGY:
# 1. Create datasets
# 2. Write some data to the datasets
# 3. Create a full send streams
# 4. Receive the send stream
# 5. Do a dry run with different options and verify the generated size
# estimate against the received stream
#
verify_runnable "both"
function cleanup
{
done
}
function cal_percentage
{
typeset value=$1
echo $return
}
function get_estimate_size
{
typeset snapshot=$1
typeset option=$2
if [[ -z $3 ]];then
else
typeset total_size=$(zfs send $option $base_snapshot $snapshot \
2>&1 | tail -1)
fi
else
total_size=${total_size%M}
fi
echo $total_size
}
function verify_size_estimates
{
typeset options=$1
typeset file_size=$2
typeset expected_diff=$(cal_percentage $refer_size)
[[ -z $refer_diff && -z $file_diff && -z $expected_diff ]] && \
[[ $refer_diff -le $expected_diff && \
$file_diff -le $expected_diff ]] || \
}
log_assert "Verify 'zfs send -nvP' generates valid stream estimates"
typeset -l block_count=0
typeset -l block_size
typeset -i PERCENT=1
# create dataset
# create multiple snapshot for the dataset with data
done
full_snapshot="$TESTPOOL/$TESTFS1@snap64"
increamental_snapshot="$TESTPOOL/$TESTFS1@snap256"
full_size=$(zfs send $full_snapshot 2>&1 | wc -c)
increamental_size=$(zfs send $increamental_snapshot 2>&1 | wc -c)
increamental_send=$(zfs send -i $full_snapshot $increamental_snapshot 2>&1 | wc -c)
log_note "verify zfs send -nv"
options="-nv"
log_note "verify zfs send -Pnv"
options="-Pnv"
log_note "verify zfs send -nv for multiple snapshot send"
options="-nv"
log_note "verify zfs send -vPn for multiple snapshot send"
options="-vPn"
log_note "verify zfs send -inv for increamental send"
options="-nvi"
log_note "verify zfs send -ivPn for increamental send"
options="-vPni"
#setup_recursive_send
# create nested datasets
# verify dataset creation
done
done
# create recursive nested snapshot
done
recursive_size=$(zfs send -R $full_snapshot 2>&1 | wc -c)
log_note "verify zfs send -Rnv for recursive send"
options="-Rnv"
log_note "verify zfs send -RvPn for recursive send"
options="-RvPn"
log_pass "'zfs send' prints the correct size estimates using '-n' and '-P' options."