1# vim: filetype=sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/include/libtest.kshlib 28. $STF_SUITE/tests/zones/zones.cfg 29 30# a simple zone creation function 31function create_zone { # $ZONENAME $ZONEPATH $BRAND (optional) 32 ZNAME=$1 33 ZPATH=$2 34 BRAND=$3 35 36 if [ ! -z $BRAND ] 37 then 38 # The SUNWsn1 brand only works on debug kernels for sparc, so we 39 # check for a known symbol to see if that's there. 40 $ECHO "logmap_logscan_debug/p" | $MDB -k > /dev/null 2>&1 41 if [ $? -eq 1 ] 42 then 43 BRAND="" 44 else 45 BRAND="-t $BRAND " 46 fi 47 fi 48 49 # create a zone config file 50 $CAT > $TMPDIR/zone.${TESTCASE_ID}.cfg <<EOF 51create $BRAND 52set zonepath=$ZPATH/$ZNAME 53set autoboot=true 54exit 55EOF 56 log_note "Creating ${BRAND}zone $ZNAME on $ZPATH/$ZNAME." 57 log_must $ZONECFG -z $ZNAME -f $TMPDIR/zone.${TESTCASE_ID}.cfg > /dev/null 58 $RM $TMPDIR/zone.${TESTCASE_ID}.cfg 59} 60 61function install_zone { # $ZONENAME 62 ZNAME=$1 63 log_note "Installing $ZNAME. This may take some time." 64 log_must $ZONEADM -z $ZNAME install > /dev/null 65} 66