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