Sdiff sczbt_register.ksh


47 # or the one supplied with -f 48 49 if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ] 50 then 51 echo "sourcing ${MYCONFIG} " 52 . ${MYCONFIG} 53 else 54 PKGCONF=`dirname $0`/sczbt_config 55 echo "sourcing ${PKGCONF}" 56 . ${PKGCONF} 57 fi 58 59 # constructing the parameter file 60 61 if [ ! -d ${PARAMETERDIR} ]; then 62 echo "The value given for PARAMETERDIR (${PARAMETERDIR}) in sczbt_config is not a directory!" 63 exit 1 64 fi 65 66 if [ ! -f ${PARAMETERDIR}/sczbt_${RS} ]; then 67 cat > ${PARAMETERDIR}/sczbt_${RS} <<EOF 68 #!/usr/bin/ksh 69 # 70 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. 71 # Use is subject to license terms. 72 # 73 # 74 # Parameters for sczbt (Zone Boot) 75 # 76 # Zonename Name of the zone 77 # Zonebrand Brand of the zone. Current supported options are 78 # "native" (default), "lx" or "solaris8" 79 # Zonebootopt Zone boot options ("-s" requires that Milestone=single-user) 80 # Milestone SMF Milestone which needs to be online before the zone is 81 # considered as booted. This option is only used for the 82 # "native" Zonebrand. 83 # LXrunlevel Runlevel which needs to get reached before the zone is 84 # considered booted. This option is only used for the "lx" 85 # Zonebrand. 86 # SLrunlevel Solaris legacy runlevel which needs to get reached before the 87 # zone is considered booted. This option is only used for the 88 # "solaris8" Zonebrand. 89 # Mounts Mounts is a list of directories and their mount options, 90 # which are loopback mounted from the global zone into the 91 # newly booted zone. The mountpoint in the local zone can 92 # be different to the mountpoint from the global zone. 93 # 94 # The Mounts parameter format is as follows, 95 # 96 # Mounts="/<global zone directory>:/<local zone directory>:<mount options>" 97 # 98 # The following are valid examples for the "Mounts" variable 99 # 100 # Mounts="/globalzone-dir1:/localzone-dir1:rw" 101 # Mounts="/globalzone-dir1:/localzone-dir1:rw /globalzone-dir2:rw" 102 # The only required entry is the /<global zone directory>, the 103 # /<local zone directory> and <mount options> can be omitted. 104 # 105 # Omitting /<local zone directory> will make the local zone 106 # mountpoint the same as the global zone directory. 107 # 108 # Omitting <mount options> will not provide any mount options
118 Zonebootopt="${Zonebootopt}" 119 Milestone="${Milestone}" 120 LXrunlevel="${LXrunlevel}" 121 SLrunlevel="${SLrunlevel}" 122 Mounts="${Mounts}" 123 EOF 124 125 else 126 echo "The parameterfile ${PARAMETERDIR}/sczbt_${RS} already exists! Will not overwrite and exit." 127 exit 1 128 fi 129 130 131 # Checking dependencies for SC_NETWORK=true 132 133 SC_NETWORK=`echo ${SC_NETWORK} | /usr/xpg4/bin/tr [:upper:] [:lower:]` 134 135 if [ "${SC_NETWORK}" == "true" -a -z "${SC_LH}" ] 136 then 137 echo "Error: SC_LH is required with SC_NETWORK=true" 138 rm ${PARAMETERDIR}/sczbt_${RS} 139 exit 1 140 fi 141 142 # If the configured zone has set ip-type=exclusive, then assigning a 143 # SUNW.LogicalHostname to this zone is not possible. 144 145 IPTYPE=`/usr/sbin/zonecfg -z ${Zonename} info | /bin/grep "^ip-type:" | /bin/awk '{print $2}'` 146 147 if [ "${IPTYPE}" == "exclusive" ] && [ "${SC_NETWORK}" == "true" ] 148 then 149 echo "Error: The zone ${Zonename} has set ip-type=exclusive. This can not be combined with setting SC_NETWORK=true." 150 rm ${PARAMETERDIR}/sczbt_${RS} 151 exit 1 152 fi 153 154 # Checking dependencies for FAILOVER=true 155 156 FAILOVER=`echo ${FAILOVER} | /usr/xpg4/bin/tr [:upper:] [:lower:]` 157 158 if [ "${FAILOVER}" == "true" -a -z "${HAS_RS}" ] 159 then 160 echo "Error: HAS_RS is required with FAILOVER=true" 161 rm ${PARAMETERDIR}/sczbt_${RS} 162 exit 1 163 fi 164 165 # Setting Resource_dependencies 166 167 if [ "${SC_LH}" ] 168 then 169 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${SC_LH}" 170 else 171 RESOURCE_DEPENDENCIES= 172 fi 173 174 if [ "${HAS_RS}" ] 175 then 176 if [ "${RESOURCE_DEPENDENCIES}" ] 177 then 178 RESOURCE_DEPENDENCIES="$RESOURCE_DEPENDENCIES,${HAS_RS}" 179 else 180 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${HAS_RS}" 181 fi
195 196 else 197 198 /usr/cluster/bin/scrgadm -a -j ${RS} -g ${RG} -t SUNW.gds \ 199 -x Start_command="/opt/SUNWsczone/sczbt/bin/start_sczbt \ 200 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 201 -x Stop_command="/opt/SUNWsczone/sczbt/bin/stop_sczbt \ 202 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 203 -x Probe_command="/opt/SUNWsczone/sczbt/bin/probe_sczbt \ 204 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 205 -x Network_aware=false \ 206 -x Stop_signal=9 ${RESOURCE_DEPENDENCIES} 207 208 fi 209 210 St=$? 211 212 if [ "${St}" -ne 0 ]; then 213 echo "Registration of resource ${RS} failed, please correct the wrong parameters." 214 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}." 215 rm ${PARAMETERDIR}/sczbt_${RS} 216 exit 1 217 else 218 echo "Registration of resource ${RS} succeeded." 219 fi 220 221 # VALIDATE RESOURCE 222 223 /opt/SUNWsczone/sczbt/bin/validate_sczbt -R ${RS} -G ${RG} -P ${PARAMETERDIR} 224 225 St=$? 226 227 if [ "${St}" -ne 0 ]; then 228 echo "Validation of resource ${RS} failed, check the syslog for the wrong parameters." 229 echo "Removing resource ${RS} from the cluster configuration." 230 231 /usr/cluster/bin/scrgadm -r -j ${RS} 232 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}." 233 rm ${PARAMETERDIR}/sczbt_${RS} 234 235 exit 1 236 else 237 echo "Validation of resource ${RS} succeeded." 238 fi 239 240 exit 0


47 # or the one supplied with -f 48 49 if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ] 50 then 51 echo "sourcing ${MYCONFIG} " 52 . ${MYCONFIG} 53 else 54 PKGCONF=`dirname $0`/sczbt_config 55 echo "sourcing ${PKGCONF}" 56 . ${PKGCONF} 57 fi 58 59 # constructing the parameter file 60 61 if [ ! -d ${PARAMETERDIR} ]; then 62 echo "The value given for PARAMETERDIR (${PARAMETERDIR}) in sczbt_config is not a directory!" 63 exit 1 64 fi 65 66 if [ ! -f ${PARAMETERDIR}/sczbt_${RS} ]; then 67 /bin/cat > ${PARAMETERDIR}/sczbt_${RS} <<EOF 68 #!/usr/bin/ksh 69 # 70 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 71 # Use is subject to license terms. 72 # 73 # 74 # Parameters for sczbt (Zone Boot) 75 # 76 # Zonename Name of the zone 77 # Zonebrand Brand of the zone. Current supported options are 78 # "native" (default), "lx", "solaris8" or "solaris9" 79 # Zonebootopt Zone boot options ("-s" requires that Milestone=single-user) 80 # Milestone SMF Milestone which needs to be online before the zone is 81 # considered as booted. This option is only used for the 82 # "native" Zonebrand. 83 # LXrunlevel Runlevel which needs to get reached before the zone is 84 # considered booted. This option is only used for the "lx" 85 # Zonebrand. 86 # SLrunlevel Solaris legacy runlevel which needs to get reached before the 87 # zone is considered booted. This option is only used for the 88 # "solaris8" or "solaris9" Zonebrand. 89 # Mounts Mounts is a list of directories and their mount options, 90 # which are loopback mounted from the global zone into the 91 # newly booted zone. The mountpoint in the local zone can 92 # be different to the mountpoint from the global zone. 93 # 94 # The Mounts parameter format is as follows, 95 # 96 # Mounts="/<global zone directory>:/<local zone directory>:<mount options>" 97 # 98 # The following are valid examples for the "Mounts" variable 99 # 100 # Mounts="/globalzone-dir1:/localzone-dir1:rw" 101 # Mounts="/globalzone-dir1:/localzone-dir1:rw /globalzone-dir2:rw" 102 # The only required entry is the /<global zone directory>, the 103 # /<local zone directory> and <mount options> can be omitted. 104 # 105 # Omitting /<local zone directory> will make the local zone 106 # mountpoint the same as the global zone directory. 107 # 108 # Omitting <mount options> will not provide any mount options
118 Zonebootopt="${Zonebootopt}" 119 Milestone="${Milestone}" 120 LXrunlevel="${LXrunlevel}" 121 SLrunlevel="${SLrunlevel}" 122 Mounts="${Mounts}" 123 EOF 124 125 else 126 echo "The parameterfile ${PARAMETERDIR}/sczbt_${RS} already exists! Will not overwrite and exit." 127 exit 1 128 fi 129 130 131 # Checking dependencies for SC_NETWORK=true 132 133 SC_NETWORK=`echo ${SC_NETWORK} | /usr/xpg4/bin/tr [:upper:] [:lower:]` 134 135 if [ "${SC_NETWORK}" == "true" -a -z "${SC_LH}" ] 136 then 137 echo "Error: SC_LH is required with SC_NETWORK=true" 138 /bin/rm ${PARAMETERDIR}/sczbt_${RS} 139 exit 1 140 fi 141 142 # If the configured zone has set ip-type=exclusive, then assigning a 143 # SUNW.LogicalHostname to this zone is not possible. 144 145 IPTYPE=`/usr/sbin/zonecfg -z ${Zonename} info | /bin/grep "^ip-type:" | /bin/awk '{print $2}'` 146 147 if [ "${IPTYPE}" == "exclusive" ] && [ "${SC_NETWORK}" == "true" ] 148 then 149 echo "Error: The zone ${Zonename} has set ip-type=exclusive. This can not be combined with setting SC_NETWORK=true." 150 /bin/rm ${PARAMETERDIR}/sczbt_${RS} 151 exit 1 152 fi 153 154 # Checking dependencies for FAILOVER=true 155 156 FAILOVER=`echo ${FAILOVER} | /usr/xpg4/bin/tr [:upper:] [:lower:]` 157 158 if [ "${FAILOVER}" == "true" -a -z "${HAS_RS}" ] 159 then 160 echo "Error: HAS_RS is required with FAILOVER=true" 161 /bin/rm ${PARAMETERDIR}/sczbt_${RS} 162 exit 1 163 fi 164 165 # Setting Resource_dependencies 166 167 if [ "${SC_LH}" ] 168 then 169 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${SC_LH}" 170 else 171 RESOURCE_DEPENDENCIES= 172 fi 173 174 if [ "${HAS_RS}" ] 175 then 176 if [ "${RESOURCE_DEPENDENCIES}" ] 177 then 178 RESOURCE_DEPENDENCIES="$RESOURCE_DEPENDENCIES,${HAS_RS}" 179 else 180 RESOURCE_DEPENDENCIES="-y Resource_dependencies=${HAS_RS}" 181 fi
195 196 else 197 198 /usr/cluster/bin/scrgadm -a -j ${RS} -g ${RG} -t SUNW.gds \ 199 -x Start_command="/opt/SUNWsczone/sczbt/bin/start_sczbt \ 200 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 201 -x Stop_command="/opt/SUNWsczone/sczbt/bin/stop_sczbt \ 202 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 203 -x Probe_command="/opt/SUNWsczone/sczbt/bin/probe_sczbt \ 204 -R ${RS} -G ${RG} -P ${PARAMETERDIR}" \ 205 -x Network_aware=false \ 206 -x Stop_signal=9 ${RESOURCE_DEPENDENCIES} 207 208 fi 209 210 St=$? 211 212 if [ "${St}" -ne 0 ]; then 213 echo "Registration of resource ${RS} failed, please correct the wrong parameters." 214 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}." 215 /bin/rm ${PARAMETERDIR}/sczbt_${RS} 216 exit 1 217 else 218 echo "Registration of resource ${RS} succeeded." 219 fi 220 221 # VALIDATE RESOURCE 222 223 /opt/SUNWsczone/sczbt/bin/validate_sczbt -R ${RS} -G ${RG} -P ${PARAMETERDIR} 224 225 St=$? 226 227 if [ "${St}" -ne 0 ]; then 228 echo "Validation of resource ${RS} failed, check the syslog for the wrong parameters." 229 echo "Removing resource ${RS} from the cluster configuration." 230 231 /usr/cluster/bin/scrgadm -r -j ${RS} 232 echo "Removing parameterfile ${PARAMETERDIR}/sczbt_${RS} for resource ${RS}." 233 /bin/rm ${PARAMETERDIR}/sczbt_${RS} 234 235 exit 1 236 else 237 echo "Validation of resource ${RS} succeeded." 238 fi 239 240 exit 0