Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- /workspace/tf84964/oscds-6662001-6610950/webrev/usr/src/cmd/ha-services/gds-agents/zone/sczbt/sczbt_register.ksh-
+++ sczbt_register.ksh
1 1 #!/usr/bin/ksh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the License).
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/CDDL.txt
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/CDDL.txt.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets [] replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 -# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 +# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27 #ident "%Z%%M% %I% %E% SMI"
28 28 #
29 29 # This script has the optional -f option:
30 30 # -f <filename> sources a user definable config file
31 31 # different from sczbt_config.
32 32
33 33 MYNAME=`basename ${0}`
34 34
35 35 typeset opt
36 36
37 37 while getopts 'f:' opt
38 38 do
39 39 case "${opt}" in
40 40 f) MYCONFIG=${OPTARG};;
41 41 *) echo "ERROR: ${MYNAME} Option ${OPTARG} unknown - early End. Only -f is valid"
42 42 exit 1;;
43 43 esac
44 44 done
45 45
46 46 # Sourcing the specified config file, either the default one,
47 47 # or the one supplied with -f
48 48
49 49 if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ]
50 50 then
51 51 echo "sourcing ${MYCONFIG} "
52 52 . ${MYCONFIG}
53 53 else
54 54 PKGCONF=`dirname $0`/sczbt_config
55 55 echo "sourcing ${PKGCONF}"
56 56 . ${PKGCONF}
57 57 fi
58 58
59 59 # constructing the parameter file
60 60
61 61 if [ ! -d ${PARAMETERDIR} ]; then
62 62 echo "The value given for PARAMETERDIR (${PARAMETERDIR}) in sczbt_config is not a directory!"
63 63 exit 1
64 64 fi
65 65
66 66 if [ ! -f ${PARAMETERDIR}/sczbt_${RS} ]; then
67 67 cat > ${PARAMETERDIR}/sczbt_${RS} <<EOF
68 68 #!/usr/bin/ksh
69 69 #
70 70 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
71 71 # Use is subject to license terms.
72 72 #
73 73 #
74 74 # Parameters for sczbt (Zone Boot)
75 75 #
76 76 # Zonename Name of the zone
77 77 # Zonebrand Brand of the zone. Current supported options are
78 78 # "native" (default), "lx" or "solaris8"
79 79 # Zonebootopt Zone boot options ("-s" requires that Milestone=single-user)
80 80 # Milestone SMF Milestone which needs to be online before the zone is
81 81 # considered as booted. This option is only used for the
82 82 # "native" Zonebrand.
83 83 # LXrunlevel Runlevel which needs to get reached before the zone is
84 84 # considered booted. This option is only used for the "lx"
85 85 # Zonebrand.
86 86 # SLrunlevel Solaris legacy runlevel which needs to get reached before the
87 87 # zone is considered booted. This option is only used for the
88 88 # "solaris8" Zonebrand.
89 89 # Mounts Mounts is a list of directories and their mount options,
90 90 # which are loopback mounted from the global zone into the
91 91 # newly booted zone. The mountpoint in the local zone can
92 92 # be different to the mountpoint from the global zone.
93 93 #
94 94 # The Mounts parameter format is as follows,
95 95 #
96 96 # Mounts="/<global zone directory>:/<local zone directory>:<mount options>"
97 97 #
98 98 # The following are valid examples for the "Mounts" variable
99 99 #
100 100 # Mounts="/globalzone-dir1:/localzone-dir1:rw"
101 101 # Mounts="/globalzone-dir1:/localzone-dir1:rw /globalzone-dir2:rw"
102 102 # The only required entry is the /<global zone directory>, the
103 103 # /<local zone directory> and <mount options> can be omitted.
104 104 #
105 105 # Omitting /<local zone directory> will make the local zone
106 106 # mountpoint the same as the global zone directory.
107 107 #
108 108 # Omitting <mount options> will not provide any mount options
109 109 # except the default options from the mount command.
110 110 #
111 111 # Note: You must manually create any local zone mountpoint
112 112 # directories that will be used within the Mounts variable,
113 113 # before registering this resource within Sun Cluster.
114 114 #
115 115
116 116 Zonename="${Zonename}"
117 117 Zonebrand="${Zonebrand}"
118 118 Zonebootopt="${Zonebootopt}"
119 119 Milestone="${Milestone}"
120 120 LXrunlevel="${LXrunlevel}"
121 121 SLrunlevel="${SLrunlevel}"
122 122 Mounts="${Mounts}"
|
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
123 123 EOF
124 124
125 125 else
126 126 echo "The parameterfile ${PARAMETERDIR}/sczbt_${RS} already exists! Will not overwrite and exit."
127 127 exit 1
128 128 fi
129 129
130 130
131 131 # Checking dependencies for SC_NETWORK=true
132 132
133 -SC_NETWORK=`echo ${SC_NETWORK}|/usr/bin/tr [:upper:] [:lower:]`
133 +SC_NETWORK=`echo ${SC_NETWORK} | /usr/xpg4/bin/tr [:upper:] [:lower:]`
134 134
135 135 if [ "${SC_NETWORK}" == "true" -a -z "${SC_LH}" ]
136 136 then
137 137 echo "Error: SC_LH is required with SC_NETWORK=true"
138 138 rm ${PARAMETERDIR}/sczbt_${RS}
139 139 exit 1
140 140 fi
141 141
142 142 # If the configured zone has set ip-type=exclusive, then assigning a
143 143 # SUNW.LogicalHostname to this zone is not possible.
144 144
145 145 IPTYPE=`/usr/sbin/zonecfg -z ${Zonename} info | /bin/grep "^ip-type:" | /bin/awk '{print $2}'`
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
146 146
147 147 if [ "${IPTYPE}" == "exclusive" ] && [ "${SC_NETWORK}" == "true" ]
148 148 then
149 149 echo "Error: The zone ${Zonename} has set ip-type=exclusive. This can not be combined with setting SC_NETWORK=true."
150 150 rm ${PARAMETERDIR}/sczbt_${RS}
151 151 exit 1
152 152 fi
153 153
154 154 # Checking dependencies for FAILOVER=true
155 155
156 -FAILOVER=`echo ${FAILOVER}|/usr/bin/tr [:upper:] [:lower:]`
156 +FAILOVER=`echo ${FAILOVER} | /usr/xpg4/bin/tr [:upper:] [:lower:]`
157 157
158 158 if [ "${FAILOVER}" == "true" -a -z "${HAS_RS}" ]
159 159 then
160 160 echo "Error: HAS_RS is required with FAILOVER=true"
161 161 rm ${PARAMETERDIR}/sczbt_${RS}
162 162 exit 1
163 163 fi
164 164
165 165 # Setting Resource_dependencies
166 166
167 167 if [ "${SC_LH}" ]
168 168 then
169 169 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${SC_LH}"
170 170 else
171 171 RESOURCE_DEPENDENCIES=
172 172 fi
173 173
174 174 if [ "${HAS_RS}" ]
175 175 then
176 176 if [ "${RESOURCE_DEPENDENCIES}" ]
177 177 then
178 178 RESOURCE_DEPENDENCIES="$RESOURCE_DEPENDENCIES,${HAS_RS}"
179 179 else
180 180 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${HAS_RS}"
181 181 fi
182 182 fi
183 183
184 184 if [ ${SC_NETWORK} == "true" ]; then
185 185
186 186 /usr/cluster/bin/scrgadm -a -j ${RS} -g ${RG} -t SUNW.gds \
187 187 -x Start_command="/opt/SUNWsczone/sczbt/bin/start_sczbt \
188 188 -R ${RS} -G ${RG} -P ${PARAMETERDIR} " \
189 189 -x Stop_command="/opt/SUNWsczone/sczbt/bin/stop_sczbt \
190 190 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \
191 191 -x Probe_command="/opt/SUNWsczone/sczbt/bin/probe_sczbt \
192 192 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \
193 193 -y Port_list=10000/tcp -y Network_resources_used=${SC_LH} \
194 194 -x Stop_signal=9 ${RESOURCE_DEPENDENCIES}
195 195
196 196 else
197 197
198 198 /usr/cluster/bin/scrgadm -a -j ${RS} -g ${RG} -t SUNW.gds \
199 199 -x Start_command="/opt/SUNWsczone/sczbt/bin/start_sczbt \
200 200 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \
201 201 -x Stop_command="/opt/SUNWsczone/sczbt/bin/stop_sczbt \
202 202 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \
203 203 -x Probe_command="/opt/SUNWsczone/sczbt/bin/probe_sczbt \
204 204 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \
205 205 -x Network_aware=false \
206 206 -x Stop_signal=9 ${RESOURCE_DEPENDENCIES}
207 207
208 208 fi
209 209
210 210 St=$?
211 211
212 212 if [ "${St}" -ne 0 ]; then
213 213 echo "Registration of resource ${RS} failed, please correct the wrong parameters."
214 214 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}."
215 215 rm ${PARAMETERDIR}/sczbt_${RS}
216 216 exit 1
217 217 else
218 218 echo "Registration of resource ${RS} succeeded."
219 219 fi
220 220
221 221 # VALIDATE RESOURCE
222 222
223 223 /opt/SUNWsczone/sczbt/bin/validate_sczbt -R ${RS} -G ${RG} -P ${PARAMETERDIR}
224 224
225 225 St=$?
226 226
227 227 if [ "${St}" -ne 0 ]; then
228 228 echo "Validation of resource ${RS} failed, check the syslog for the wrong parameters."
229 229 echo "Removing resource ${RS} from the cluster configuration."
230 230
231 231 /usr/cluster/bin/scrgadm -r -j ${RS}
232 232 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}."
233 233 rm ${PARAMETERDIR}/sczbt_${RS}
234 234
235 235 exit 1
236 236 else
237 237 echo "Validation of resource ${RS} succeeded."
238 238 fi
239 239
240 240 exit 0
|
↓ open down ↓ |
74 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX