1d583b39bSJohn Wren Kennedy#!/usr/bin/ksh -p 2d583b39bSJohn Wren Kennedy# 3d583b39bSJohn Wren Kennedy# CDDL HEADER START 4d583b39bSJohn Wren Kennedy# 5d583b39bSJohn Wren Kennedy# The contents of this file are subject to the terms of the 6d583b39bSJohn Wren Kennedy# Common Development and Distribution License (the "License"). 7d583b39bSJohn Wren Kennedy# You may not use this file except in compliance with the License. 8d583b39bSJohn Wren Kennedy# 9d583b39bSJohn Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10d583b39bSJohn Wren Kennedy# or http://www.opensolaris.org/os/licensing. 11d583b39bSJohn Wren Kennedy# See the License for the specific language governing permissions 12d583b39bSJohn Wren Kennedy# and limitations under the License. 13d583b39bSJohn Wren Kennedy# 14d583b39bSJohn Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each 15d583b39bSJohn Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16d583b39bSJohn Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the 17d583b39bSJohn Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying 18d583b39bSJohn Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner] 19d583b39bSJohn Wren Kennedy# 20d583b39bSJohn Wren Kennedy# CDDL HEADER END 21d583b39bSJohn Wren Kennedy# 22d583b39bSJohn Wren Kennedy 23d583b39bSJohn Wren Kennedy# 24d583b39bSJohn Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25d583b39bSJohn Wren Kennedy# Use is subject to license terms. 26d583b39bSJohn Wren Kennedy# 27c029eafbSHans Rosenfeld# Copyright 2015 Nexenta Systems, Inc. 28c029eafbSHans Rosenfeld# 29d583b39bSJohn Wren Kennedy 304b5c8e93SMatthew Ahrens# 311d32ba66SJohn Wren Kennedy# Copyright (c) 2012, 2016 by Delphix. All rights reserved. 32*c09fb523SKody Kantor# Copyright 2019 Joyent, Inc. 334b5c8e93SMatthew Ahrens# 344b5c8e93SMatthew Ahrens 355cabbc6bSPrashanth Sreenivasa# 365cabbc6bSPrashanth Sreenivasa# Copyright (c) 2012, 2015 by Delphix. All rights reserved. 375cabbc6bSPrashanth Sreenivasa# 385cabbc6bSPrashanth Sreenivasa 39d583b39bSJohn Wren Kennedy. $STF_SUITE/include/libtest.shlib 40d583b39bSJohn Wren Kennedy 41d583b39bSJohn Wren Kennedy# 42d583b39bSJohn Wren Kennedy# DESCRIPTION: 43d583b39bSJohn Wren Kennedy# 44c029eafbSHans Rosenfeld# Valid datasets and snapshots are accepted as bootfs property values 45d583b39bSJohn Wren Kennedy# 46d583b39bSJohn Wren Kennedy# STRATEGY: 47c029eafbSHans Rosenfeld# 1. Create a set of datasets and snapshots in a test pool 48d583b39bSJohn Wren Kennedy# 2. Try setting them as boot filesystems 49d583b39bSJohn Wren Kennedy# 50d583b39bSJohn Wren Kennedy 51d583b39bSJohn Wren Kennedyverify_runnable "global" 52d583b39bSJohn Wren Kennedy 53d583b39bSJohn Wren Kennedyfunction cleanup { 54d583b39bSJohn Wren Kennedy if poolexists $TESTPOOL ; then 551d32ba66SJohn Wren Kennedy log_must zpool destroy $TESTPOOL 56d583b39bSJohn Wren Kennedy fi 57d583b39bSJohn Wren Kennedy 58d583b39bSJohn Wren Kennedy if [[ -f $VDEV ]]; then 591d32ba66SJohn Wren Kennedy log_must rm -f $VDEV 60d583b39bSJohn Wren Kennedy fi 61d583b39bSJohn Wren Kennedy} 62d583b39bSJohn Wren Kennedy 631d32ba66SJohn Wren Kennedyzpool set 2>&1 | grep bootfs > /dev/null 64d583b39bSJohn Wren Kennedyif [ $? -ne 0 ] 65d583b39bSJohn Wren Kennedythen 66d583b39bSJohn Wren Kennedy log_unsupported "bootfs pool property not supported on this release." 67d583b39bSJohn Wren Kennedyfi 68d583b39bSJohn Wren Kennedy 69d583b39bSJohn Wren Kennedylog_assert "Valid datasets are accepted as bootfs property values" 70d583b39bSJohn Wren Kennedylog_onexit cleanup 71d583b39bSJohn Wren Kennedy 72*c09fb523SKody Kantortypeset VDEV=$TESTDIR/bootfs_001_pos_a.$$.dat 73d583b39bSJohn Wren Kennedy 741d32ba66SJohn Wren Kennedylog_must mkfile $MINVDEVSIZE $VDEV 75d583b39bSJohn Wren Kennedycreate_pool "$TESTPOOL" "$VDEV" 761d32ba66SJohn Wren Kennedylog_must zfs create $TESTPOOL/$TESTFS 77d583b39bSJohn Wren Kennedy 781d32ba66SJohn Wren Kennedylog_must zfs snapshot $TESTPOOL/$TESTFS@snap 791d32ba66SJohn Wren Kennedylog_must zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone 80d583b39bSJohn Wren Kennedy 811d32ba66SJohn Wren Kennedylog_must zpool set bootfs=$TESTPOOL/$TESTFS $TESTPOOL 821d32ba66SJohn Wren Kennedylog_must zpool set bootfs=$TESTPOOL/$TESTFS@snap $TESTPOOL 831d32ba66SJohn Wren Kennedylog_must zpool set bootfs=$TESTPOOL/clone $TESTPOOL 84d583b39bSJohn Wren Kennedy 851d32ba66SJohn Wren Kennedylog_must zfs promote $TESTPOOL/clone 861d32ba66SJohn Wren Kennedylog_must zpool set bootfs=$TESTPOOL/clone $TESTPOOL 87d583b39bSJohn Wren Kennedylog_pass "Valid datasets are accepted as bootfs property values" 88