xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_013_pos.ksh (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3
4#
5# This file and its contents are supplied under the terms of the
6# Common Development and Distribution License ("CDDL"), version 1.0.
7# You may only use this file in accordance with the terms of version
8# 1.0 of the CDDL.
9#
10# A full copy of the text of the CDDL should have accompanied this
11# source.  A copy of the CDDL is also available via the Internet at
12# http://www.illumos.org/license/CDDL.
13#
14
15#
16# Copyright (c) 2018 by Delphix. All rights reserved.
17#
18
19. $STF_SUITE/tests/functional/alloc_class/alloc_class.kshlib
20
21#
22# DESCRIPTION:
23#	Removing a dedup device from a pool succeeds.
24#
25
26verify_runnable "global"
27
28claim="Removing a dedup device from a pool succeeds."
29
30log_assert $claim
31log_onexit cleanup
32
33#
34# Create a non-raidz pool so we can remove top-level vdevs
35#
36log_must disk_setup
37log_must zpool create $TESTPOOL $ZPOOL_DISKS dedup $CLASS_DISK0
38log_must display_status "$TESTPOOL"
39
40#
41# Generate some dedup data in the dedup class before removal
42#
43
44log_must zfs create -o dedup=on -V 2G $TESTPOOL/$TESTVOL
45block_device_wait "$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL"
46log_must eval "new_fs $ZVOL_DEVDIR/$TESTPOOL/$TESTVOL >/dev/null"
47
48sync_pool
49log_must zpool list -v $TESTPOOL
50
51#
52# remove a dedup allocation vdev
53#
54log_must zpool remove $TESTPOOL $CLASS_DISK0
55
56sleep 5
57sync_pool $TESTPOOL
58sleep 1
59
60log_must zdb -bbcc $TESTPOOL
61
62log_must zpool destroy -f "$TESTPOOL"
63
64log_pass $claim
65