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