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# ident "@(#)zones_common.kshlib 1.3 07/03/14 SMI" 28# 29 30. $STF_SUITE/include/libtest.kshlib 31. $STF_SUITE/tests/zones/zones.cfg 32 33# a simple zone creation function 34function create_zone { # $ZONENAME $ZONEPATH $BRAND (optional) 35 ZNAME=$1 36 ZPATH=$2 37 BRAND=$3 38 39 if [ ! -z $BRAND ] 40 then 41 # The SUNWsn1 brand only works on debug kernels for sparc, so we 42 # check for a known symbol to see if that's there. 43 $ECHO "logmap_logscan_debug/p" | $MDB -k > /dev/null 2>&1 44 if [ $? -eq 1 ] 45 then 46 BRAND="" 47 else 48 BRAND="-t $BRAND " 49 fi 50 fi 51 52 # create a zone config file 53 $CAT > $TMPDIR/zone.${TESTCASE_ID}.cfg <<EOF 54create $BRAND 55set zonepath=$ZPATH/$ZNAME 56set autoboot=true 57exit 58EOF 59 log_note "Creating ${BRAND}zone $ZNAME on $ZPATH/$ZNAME." 60 log_must $ZONECFG -z $ZNAME -f $TMPDIR/zone.${TESTCASE_ID}.cfg > /dev/null 61 $RM $TMPDIR/zone.${TESTCASE_ID}.cfg 62} 63 64function install_zone { # $ZONENAME 65 ZNAME=$1 66 log_note "Installing $ZNAME. This may take some time." 67 log_must $ZONEADM -z $ZNAME install > /dev/null 68} 69