zfs_clone_010_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 list -t all -o name,origin,clones' prints the correct
# clone information
#
# STRATEGY:
# 1. Create datasets
# 2. Create recursive snapshots and their clones
# 3. Verify zfs clones property displays right information for different
# cases
#
verify_runnable "both"
function local_cleanup
{
typeset -i i=1
datasetexists $ds/$TESTCLONE.$i && \
((i=i+1))
done
}
# Set up filesystem with clones
function setup_ds
{
typeset -i i=1
# create nested datasets
# verify dataset creation
datasetexists $ds || log_fail "Create $ds dataset fail."
done
# create recursive nested snapshot
datasetexists $ds@snap || \
done
done
((i=i+1))
done
}
# Verify clone list
function verify_clones
{
typeset -i no_clones=$1
typeset unexpected=$2
typeset clone_snap=$3
typeset -i i=1
if [[ -n $clone_snap ]]; then
clone_snap=/$TESTCLONE.$i
fi
IFS=','
typeset -a clones=()
for token in $actual_clone; do
done
[[ ${#clones[*]} -ne $no_clones ]] && \
" ${#clones[*]}"
if [[ $unexpected -eq 1 ]]; then
if [[ -z $clone_snap ]]; then
[[ $match != $unexpected_clone ]] && \
exit 0; done) || log_fail \
"Unexpected clones of the snapshot"
else
[[ $match == $expected_clone ]] && \
[[ $match != $unexpected_clone ]] \
&& exit 0; done) || log_fail \
"Unexpected clones of the snapshot"
fi
else
[[ $match == $expected_clone ]] && \
exit 0; done) || log_fail \
"Unexpected clones of the snapshot"
fi
done
else
[[ $match == $expected_clone ]] && exit 0; \
" of the snapshot"
done
fi
((i=i+1))
done
}
typeset -a d_clones
typeset -a deferred_snaps
typeset -i i
i=1
log_note "Verify zfs clone propery for multiple clones"
log_note "verfify clone property for clone deletion"
i=1
((i=i+1))
done
i=1
log_note "verify zfs deferred destroy on clones property"
i=1
((i=i+1))
done
log_note "verify zfs deferred destroy by destroying clones on clones property"
d_clones=()
i=1
done
((i=i+1))
done
[[ -z $status ]] || \
done
[[ -z $status ]] || \
done
log_note "verify clone property for zfs promote"
i=1
((i=i+1))
done
i=1
((i=i+1))
done
log_note "verify clone list truncated correctly"
typeset -i j=200
i=1
while((i < 7)); do
((i=i+1))
((j=j+200))
done
log_fail "Clone list not truncated correctly. Unexpected character count" \
log_pass "'zfs list -o name,origin,clones prints the correct clone information."