1*0caa7519SOlaf Faaland#!/bin/ksh 2*0caa7519SOlaf Faaland 3*0caa7519SOlaf Faaland# 4*0caa7519SOlaf Faaland# This file and its contents are supplied under the terms of the 5*0caa7519SOlaf Faaland# Common Development and Distribution License ("CDDL"), version 1.0. 6*0caa7519SOlaf Faaland# You may only use this file in accordance with the terms of version 7*0caa7519SOlaf Faaland# 1.0 of the CDDL. 8*0caa7519SOlaf Faaland# 9*0caa7519SOlaf Faaland# A full copy of the text of the CDDL should have accompanied this 10*0caa7519SOlaf Faaland# source. A copy of the CDDL is also available via the Internet at 11*0caa7519SOlaf Faaland# http://www.illumos.org/license/CDDL. 12*0caa7519SOlaf Faaland# 13*0caa7519SOlaf Faaland 14*0caa7519SOlaf Faaland# 15*0caa7519SOlaf Faaland# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. 16*0caa7519SOlaf Faaland# 17*0caa7519SOlaf Faaland 18*0caa7519SOlaf Faaland. $STF_SUITE/include/libtest.shlib 19*0caa7519SOlaf Faaland 20*0caa7519SOlaf Faaland# 21*0caa7519SOlaf Faaland# Description: 22*0caa7519SOlaf Faaland# zdb will not produce redundant dumps of configurations 23*0caa7519SOlaf Faaland# 24*0caa7519SOlaf Faaland# Strategy: 25*0caa7519SOlaf Faaland# 1. Create a pool with two vdevs 26*0caa7519SOlaf Faaland# 2. Copy label 1 from the first vdev to the second vdev 27*0caa7519SOlaf Faaland# 3. Collect zdb -l output for both vdevs 28*0caa7519SOlaf Faaland# 4. Verify that the correct number of configs is dumped for each 29*0caa7519SOlaf Faaland# 30*0caa7519SOlaf Faaland 31*0caa7519SOlaf Faalandlog_assert "Verify zdb does not produce redundant dumps of configurations" 32*0caa7519SOlaf Faalandlog_onexit cleanup 33*0caa7519SOlaf Faaland 34*0caa7519SOlaf Faalandfunction cleanup 35*0caa7519SOlaf Faaland{ 36*0caa7519SOlaf Faaland datasetexists $TESTPOOL && destroy_pool $TESTPOOL 37*0caa7519SOlaf Faaland} 38*0caa7519SOlaf Faaland 39*0caa7519SOlaf Faalandverify_runnable "global" 40*0caa7519SOlaf Faalandverify_disk_count "$DISKS" 2 41*0caa7519SOlaf Faaland 42*0caa7519SOlaf Faalandconfig_count=(1 2) 43*0caa7519SOlaf Faalandset -A DISK $DISKS 44*0caa7519SOlaf Faaland 45*0caa7519SOlaf Faalanddefault_mirror_setup_noexit $DISKS 46*0caa7519SOlaf Faalandlog_must dd if=${DEV_DSKDIR}/${DISK[0]}s0 of=${DEV_DSKDIR}/${DISK[1]}s0 bs=1024 count=256 conv=notrunc 47*0caa7519SOlaf Faaland 48*0caa7519SOlaf Faalandfor x in 0 1 ; do 49*0caa7519SOlaf Faaland config_count=$(zdb -l $DEV_RDSKDIR/${DISK[$x]}s0 | grep -c features_for_read) 50*0caa7519SOlaf Faaland (( $? != 0)) && log_fail "failed to get config_count from DISK[$x]" 51*0caa7519SOlaf Faaland log_note "vdev $x: message_count $config_count" 52*0caa7519SOlaf Faaland [ $config_count -ne ${config_count[$x]} ] && \ 53*0caa7519SOlaf Faaland log_fail "zdb produces an incorrect number of configuration dumps." 54*0caa7519SOlaf Faalanddone 55*0caa7519SOlaf Faaland 56*0caa7519SOlaf Faalandcleanup 57*0caa7519SOlaf Faaland 58*0caa7519SOlaf Faalandlog_pass "zdb produces unique dumps of configurations." 59