xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/zvol/zvol_dump/zvol_dump_raidz.ksh (revision b7daf79982d77b491ef9662483cd4549e0e5da9a)
1#!/usr/bin/ksh -p
2
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright (c) 2017 by Delphix. All rights reserved.
16#
17
18. $STF_SUITE/include/libtest.shlib
19
20#
21# DESCRIPTION:
22# Attempt to access a dump device on a RAID-Z pool.
23#
24# STRATEGY:
25# 1. Create a RAID-Z pool.
26# 2. Create a zvol on that pool called "dump".
27# 3. Configure it with "dumpadm".
28# 4. Attempt to issue reads and writes to it.
29#
30
31# Save the current dump device so we can restore it after the test.
32orig_dump_device=$(dumpadm | awk '/Dump device/ { print $3 }')
33
34function cleanup
35{
36	log_must dumpadm -u -d $orig_dump_device
37	log_must zpool destroy -f $TESTPOOL
38}
39
40log_onexit cleanup
41
42DISK1="$(echo $DISKS | cut -d' ' -f1)"
43DISK2="$(echo $DISKS | cut -d' ' -f2)"
44DISK3="$(echo $DISKS | cut -d' ' -f3)"
45
46log_must zpool create -f $TESTPOOL raidz $DISK1 $DISK2 $DISK3
47log_must zfs create -V 8G $TESTPOOL/dump
48
49log_must dumpadm -u -d /dev/zvol/dsk/$TESTPOOL/dump
50
51log_must dd if=/dev/zvol/dsk/$TESTPOOL/dump of=/dev/null bs=1M count=1
52log_must dd if=/dev/urandom of=/dev/zvol/dsk/$TESTPOOL/dump bs=1M count=1
53
54log_pass "Reads and writes to the dump device on a RAID-Z pool were successful"
55