xref: /freebsd/tests/sys/cddl/zfs/tests/zones/zones.cfg (revision 42249ef2)
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 2008 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29# ident	"@(#)zones.cfg	1.5	08/08/15 SMI"
30#
31
32# Variables we'll use to name our zones
33# The first two zones are created by setup,
34# then destroyed in zones_004_pos - or cleanup.
35ZONE="${ZONE:=zone}"
36ZONE2="${ZONE2:=zonetwo}"
37
38# These zones are created and destroyed by zones_003_pos - or cleanup.
39ZONE3="${ZONE3:=zonethree}"
40ZONE4="${ZONE4:=zonefour}"
41
42# A function which runs through a loop, adding a different characters
43# to the stem passed as $1, to make sure we have a unique name that
44# doesn't clash with an existing zone name. Once we've found a unique
45# name, we echo that to stdout.
46#
47function find_unique_zonename { # initial name of zone
48
49	NAME=$1
50	COUNT=0
51	while [ -z "$FOUND" ]
52	do
53		NAME="${NAME}${COUNT}"
54		$ZONEADM -z $NAME list > /dev/null 2>&1
55		if [ $? -eq 1 ]
56		then
57			FOUND=true
58		fi
59		COUNT=$(( $COUNT + 1 ))
60	done
61	echo $NAME
62}
63
64# Need a longer timeout for zone installation
65export STF_TIMEOUT=3600
66
67# Make sure that multiple sourcing of this script doesn't change the zone name
68if [ -z "${RUNCONFIG}" ]
69then
70	ZONE=$(find_unique_zonename $ZONE)
71	ZONE2=$(find_unique_zonename $ZONE2)
72	ZONE3=$(find_unique_zonename $ZONE3)
73	ZONE4=$(find_unique_zonename $ZONE4)
74
75	log_note "zones.cfg gave us new zone names $ZONE,$ZONE2,$ZONE3,$ZONE4"
76
77	export ZONE
78	export ZONE2
79	export ZONE3
80	export ZONE4
81
82	export RUNCONFIG="true"
83fi
84