1*215198a6SJoe Stein#!/bin/ksh
2*215198a6SJoe Stein
3*215198a6SJoe Stein#
4*215198a6SJoe Stein# This file and its contents are supplied under the terms of the
5*215198a6SJoe Stein# Common Development and Distribution License ("CDDL"), version 1.0.
6*215198a6SJoe Stein# You may only use this file in accordance with the terms of version
7*215198a6SJoe Stein# 1.0 of the CDDL.
8*215198a6SJoe Stein#
9*215198a6SJoe Stein# A full copy of the text of the CDDL should have accompanied this
10*215198a6SJoe Stein# source.  A copy of the CDDL is also available via the Internet at
11*215198a6SJoe Stein# http://www.illumos.org/license/CDDL.
12*215198a6SJoe Stein#
13*215198a6SJoe Stein
14*215198a6SJoe Stein#
15*215198a6SJoe Stein# Copyright (c) 2015 by Delphix. All rights reserved.
16*215198a6SJoe Stein#
17*215198a6SJoe Stein
18*215198a6SJoe Stein#
19*215198a6SJoe Stein# Description:
20*215198a6SJoe Stein# Verify that per-vdev ZAPs are created with multi-level vdev tree.
21*215198a6SJoe Stein#
22*215198a6SJoe Stein# Strategy:
23*215198a6SJoe Stein# 1. Create a pool with a multi-disk mirror.
24*215198a6SJoe Stein# 2. Verify that mirror has top ZAP but no leaf ZAP.
25*215198a6SJoe Stein# 3. Verify that each disk has a leaf ZAP but no top ZAP.
26*215198a6SJoe Stein#
27*215198a6SJoe Stein
28*215198a6SJoe Stein. $STF_SUITE/include/libtest.shlib
29*215198a6SJoe Stein. $STF_SUITE/tests/functional/vdev_zaps/vdev_zaps.kshlib
30*215198a6SJoe Stein
31*215198a6SJoe Steinlog_assert "Per-vdev ZAPs are created on pool creation with multi-level vdev "\
32*215198a6SJoe Stein        "trees."
33*215198a6SJoe Stein
34*215198a6SJoe Steinlog_must zpool create -f $TESTPOOL mirror $DISKS
35*215198a6SJoe Stein
36*215198a6SJoe Steinconf="$TESTDIR/vz003"
37*215198a6SJoe Steinlog_must zdb -PC $TESTPOOL > $conf
38*215198a6SJoe Stein
39*215198a6SJoe Steinassert_has_sentinel "$conf"
40*215198a6SJoe Steinassert_top_zap $TESTPOOL "type: 'mirror'" "$conf"
41*215198a6SJoe Steinfor DISK in $DISKS; do
42*215198a6SJoe Stein	assert_leaf_zap $TESTPOOL $DISK "$conf"
43*215198a6SJoe Stein        top_zap=$(get_top_vd_zap $DISK "$conf")
44*215198a6SJoe Stein        [[ -n "$top_zap" ]] && log_fail "Leaf vdev $DISK has top-level ZAP."
45*215198a6SJoe Steindone
46*215198a6SJoe Stein
47*215198a6SJoe Steinlog_pass
48