5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# CDDL HEADER START
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# This file and its contents are supplied under the terms of the
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# Common Development and Distribution License ("CDDL"), version 1.0.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# You may only use this file in accordance with the terms of version
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 1.0 of the CDDL.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# A full copy of the text of the CDDL should have accompanied this
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# source. A copy of the CDDL is also available via the Internet at
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# CDDL HEADER END
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# DESCRIPTION:
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# refquota, like regular quota, is loosely enforced. A dataset
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# can exceed its refquota by one transaction. This loose enforcement
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# used to cause problems upon receiving a datastream where its
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# refquota is slightly exceeded. This test confirms that we can
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# successfully receive a slightly over refquota stream.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 1. Create a filesystem.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 2. Set a refquota.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 3. Snapshot the filesystem.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 4. Send a replication stream to a new filesystem.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 5. On the original filesystem, fill it up to its quota.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 6. Snapshot the original filesystem again.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 7. Send an incremental stream to the same new filesystem.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs destroy -rf $TESTPOOL/$TESTFS1
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must zfs destroy -rf $TESTPOOL/$TESTFS2
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonaldlog_assert "The allowable slight refquota overage is properly sent-and-" \
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 1. Create a filesystem.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 2. Set a refquota.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 3. Snapshot the filesystem.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 4. Send a replication stream to a new filesystem.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs send -R $orig@1 > $streamfile"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs recv $dest < $streamfile"
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 5. On the original filesystem, fill it up to its quota.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 6. Snapshot the original filesystem again.
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonald# 7. Send an incremental stream to the same new filesystem.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs send -I 1 -R $orig@2 > $streamfile"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs recv $dest < $streamfile"
5f7a8e6d750cb070a3347f045201c6206caee6aaDan McDonaldlog_pass "Verified receiving a slightly-over-refquota stream succeeds."