Build on the global zone the cluster applications which correspond to each non-global zone. Perform this section's procedure to each non-global zone.
Stop the RMS if it is running.
If it is not single-node cluster operations, delete the temporal cluster applications created with "13.2.2.5 Creating Temporal Cluster Applications." Do not perform deletion of the resources when deleting the cluster applications.
Create the Cmdline resource for controlling from the global zone the non-global zone and the cluster applications configured to the non-global zone.
If performing application monitoring within the non-global zone. (except single node cluster operations)
Create the Cmdline resource.
Select "Path Input" from the "Creation Method" for creating the Cmdline and set up the Start script, Stop script, and Check script as follows.
Start script
/opt/SMAW/bin/hvzone -c -z <zone_name> -a <app_name> {-s|-n} -t <timeout>
Stop script
/opt/SMAW/bin/hvzone -u -z <zone_name> -a <app_name> {-s|-n} -t <timeout>
Check script
/opt/SMAW/bin/hvzone -m -z <zone_name> -a <app_name> {-s|-n} -t <timeout>
The differences above are only with the -c, -u, and -m options. Specify the name of the zone that is the target for control and the name of the cluster application set up in the non-global zone for <zone_name> and <app_name> respectively.
Specify in seconds the shutdown process time out value for <timeout>. During Offline processing, this script performs RMS stop and non-global zone stop, but if the processing does not stop even after the time designated here has elapsed, stop the non-global zone using the halt command for zoneadm (zoneadm -z <zone_name> halt).
If sharing non-global zones between cluster nodes, specify the -s option. If not sharing, specify the -n option.
An example is given below. In this example, the configuration is as follows: the zone name is zone1, the cluster application name in the non-global zone is userApp_0, the timeout value is 200 seconds, and the non-global zone is being shared between cluster nodes in the global zone.
Start script
/opt/SMAW/bin/hvzone -c -z zone1 -a userApp_0 -s -t 200
Stop script
/opt/SMAW/bin/hvzone -u -z zone1 -a userApp_0 -s -t 200
Check script
/opt/SMAW/bin/hvzone -m -z zone1 -a userApp_0 -s -t 200
If one specifies the -s option, the non-global zone on the standby system side will not start and moreover the non-global zone will enter a status of being detached from that node.
After that, set up the script attributes. Click the "Flag" button and set the following values.
Flag | Overview |
---|---|
ALLEXITCODES | Change this to "Yes." |
AUTORECOVER | When "Yes" is specified, do not set the following resources.
|
STANDBYCAPABLE | If using warm-standby, change this to "Yes." |
TIMEOUT | The default value is 300 seconds. Set a value larger than the total of the following values.
|
If not conducting application monitoring within the non-global zone or single-node cluster is operated;
Create the Cmdline resource.
Create resource script files. This script is created for each Cmdline resource. Moreover, script files are created for all nodes which use Cmdline resources. The following examples show that Start script is set for"/var/tmp/PCL/rmstools/start_zone.sh", Stop script is set for "/var/tmp/PCL/rmstools/stop_zone.sh", and check script is set for "/var/tmp/PCL/rmstools/check_zone.sh". The contents can be modified according to the elements. If the /var/tmp/PCL/rmstools directory does not exist, create the directory.
Create script file
# vi /var/tmp/PCL/rmstools/start_zone.sh (Paste the following the content of Start script file) # vi /var/tmp/PCL/rmstools/stop_zone.sh (Paste the following the content of Stop script file) # vi /var/tmp/PCL/rmstools/check_zone.sh (Paste the following the content of Check script file) # chmod +x /var/tmp/PCL/rmstools/start_zone.sh # chmod +x /var/tmp/PCL/rmstools/stop_zone.sh # chmod +x /var/tmp/PCL/rmstools/check_zone.sh
Start script
#!/bin/sh MYZONE=$1 zoneadm -z $MYZONE list -p | grep :configured: if [ $? -eq 0 ]; then zoneadm -z $MYZONE attach -F || exit $? fi zoneadm -z $MYZONE list -p | grep :running: if [ $? -eq 0 ]; then zoneadm -z $MYZONE reboot RET=$? else zoneadm -z $MYZONE boot RET=$? fi exit $RET
Stop script
#!/bin/sh MYZONE=$1 RET=0 RET2=0 zoneadm -z $MYZONE list -p | grep :running: if [ $? -eq 0 ]; then zoneadm -z $MYZONE halt RET=$? fi zoneadm -z $MYZONE list -p | grep :installed: if [ $? -eq 0 ]; then zoneadm -z $MYZONE detach RET2=$? fi if [ $RET -eq 0 ]; then exit $RET2 fi exit $RET
Check script
#!/bin/sh # Return Offline if zlogin to the NGZ does not end in 30 seconds (Please change if needed) TIMEOUT=30 MYZONE=$1 zoneadm -z $MYZONE list -p | grep :running: > /dev/null 2>&1 RET=$? if [ $RET -ne 0 ]; then exit $RET fi /usr/sbin/zlogin $MYZONE "/usr/bin/ls >/dev/null 2>&1" 2>/dev/null & PID=$! i=0 while [ $i -lt $TIMEOUT ] do ps -p $PID > /dev/null 2>&1 if [ $? -ne 0 ]; then wait $PID exit $? fi sleep 1 i=`expr $i + 1` done exit 1
Select "Path Input" from the "Creation Method" for creating the Cmdline and set up the Start script, Stop script, and Check script as follows. (When the zone name is zone1.)
Start script
/var/tmp/PCL/rmstools/start_zone.sh zone1
Stop script
/var/tmp/PCL/rmstools/stop_zone.sh zone1
Check script
/var/tmp/PCL/rmstools/check_zone.sh zone1
Then set attributes for the scripts. Click the Flag button and set the value below.
Flag | Overview |
---|---|
AUTORECOVER |
|
If using a shared IP zone non-global zone but not sharing non-global zone images, create a resource for the takeover IP address in the global zone.
Create the script file for all nodes which use Cmdline resource. If the /var/tmp/PCL/rmstools directory does not exist, create the directory.
Create hvzonelip.sh script file (when using GLS NIC switching mode, or not using GLS)
# vi /var/tmp/PCL/rmstools/hvzonelip.sh (Paste the content of the following hvzonelip.sh script file) # chmod +x /var/tmp/PCL/rmstools/hvzonelip.sh
Create hvzonelifrsc.sh script file (when using GLS fast switching mode or GS/SURE linkage mode)
# vi /var/tmp/PCL/rmstools/hvzonelifrsc.sh (Paste the following the content of hvzonelifrsc.sh script file) # chmod +x /var/tmp/PCL/rmstools/hvzonelifrsc.sh
Content of hvzonelip.sh script file (if being used with an NIC switching mode for GLS or if not using GLS)
#!/bin/sh # # hvzonelip.sh 1.1 # LIP="" IPMASK="" IFLIST="" IPTYPE="" ZONENAME="" ZONEWAIT="" #-------------------------------------------------- # Add Logical IP #-------------------------------------------------- TAG=`/usr/bin/basename $0` CONFFILE=$2 RSCNAME=${HV_NODENAME:-Unknown} PHASE=${HV_INTENDED_STATE:-Unknown} Start() { ADDINGIP=$LIP IFATTR="netmask + broadcast + -trailers" IFCFG_RETRY_CNT=4 if [ "$IPTYPE" = "inet6" ] then ADDINGIP="$LIP"/"$IPMASK" IFATTR="" fi for PIF in $IFLIST do /usr/sbin/ifconfig $PIF $IPTYPE 2>/dev/null | /bin/grep "UP," >/dev/null 2>&1 if [ $? -eq 0 ] then break fi done CheckIp $PIF $ADDINGIP $ZONENAME if [ $? != 0 ] then Pmsg INFO "ip address has already been assigned. if=$CHKIF LIP=$LIP ZONENAME=$ZONENAME" return 0 fi RET=1 CNT=0 while [ $RET -ne 0 ] && [ $CNT -le $IFCFG_RETRY_CNT ] do CNT=`/usr/bin/expr $CNT + 1` CMD="/usr/sbin/ifconfig $PIF $IPTYPE addif $ADDINGIP $IFATTR up zone $ZONENAME" Pmsg TRACE "$CMD" $CMD RET=$? Pmsg TRACE "exitcode = $RET" done if [ $RET -ne 0 ] then Pmsg ERROR "ifconfig failed. cmd=$CMD" fi return $RET } CheckIp() { CHKPIF=$1 CHKLIP=$2 CHKZONE=$3 CHKIF= CHKIFCAU=`/usr/sbin/ifconfig -au $IPTYPE 2>/dev/null` echo "$CHKIFCAU" | /bin/grep "$IPTYPE $CHKLIP " >/dev/null 2>&1 if [ $? != 0 ] then return 0 fi CHKIFLIST=`echo "$CHKIFCAU" | /bin/grep "^$CHKPIF:[0-9]*: " | /usr/bin/sed -e "s/: .*//"` for CHKIF in $CHKIFLIST do CHKIFC=`/usr/sbin/ifconfig $CHKIF $IPTYPE 2>/dev/null` echo "$CHKIFC" | /bin/grep "$IPTYPE $CHKLIP " >/dev/null 2>&1 if [ $? != 0 ] then continue fi echo "$CHKIFC" | /bin/grep "zone $CHKZONE$" >/dev/null 2>&1 if [ $? != 0 -a "$CHKZONE" != "global" ] then continue fi return 1 done return 0 } #-------------------------------------------------- # Remove Logical IP #-------------------------------------------------- Stop() { IFCFG_RETRY_CNT=9 for PIF in $IFLIST do RET=0 CNT=0 while [ $RET -eq 0 ] && [ $CNT -le $IFCFG_RETRY_CNT ] do CNT=`/usr/bin/expr $CNT + 1` CMD="/usr/sbin/ifconfig $PIF $IPTYPE removeif $LIP" Pmsg TRACE "$CMD" $CMD 2>/dev/null RET=$? Pmsg TRACE "exitcode = $RET" done done return 0 } #-------------------------------------------------- # Common functions #-------------------------------------------------- WaitForZoneBoot() { MSGFLAG=0 while [ 1 ] do ZONESTATUS=`/usr/sbin/zoneadm -z "$ZONENAME" list -p 2>/dev/null | /bin/grep ":shared" | /usr/bin/nawk -F: '{ print $3 }'` if [ "$ZONESTATUS" = "ready" -o "$ZONESTATUS" = "running" ] then break fi if [ "$ZONESTATUS" = "" ] then Pmsg ERROR "shared-ip zone does not exist. ZONENAME=$ZONENAME" return 1 fi if [ "$MSGFLAG" = 0 ] then Pmsg INFO "wait for zone boot. stat=$ZONESTATUS ZONENAME=$ZONENAME" MSGFLAG=1 fi sleep 1 done if [ "$MSGFLAG" = 1 ] then Pmsg INFO "finished waiting. stat=$ZONESTATUS ZONENAME=$ZONENAME" fi return 0 } Pmsg() { TSTAMP=`/usr/bin/date +"%Y-%m-%d %H:%M:%S"` echo "$RSCNAME: $PHASE: $TSTAMP: $1: $TAG($$) $2" return 0 } ReadConf() { if [ -r "$CONFFILE" ] then . $CONFFILE fi if [ -z "$LIP" -o -z "$IPMASK" -o -z "$IFLIST" -o -z "$IPTYPE" -o -z "$ZONENAME" ] then Pmsg ERROR "configuration error. LIP=$LIP IPMASK=$IPMASK IFLIST=$IFLIST IPTYPE=$IPTYPE ZONENAME=$ZONENAME" return 1 fi return 0 } #-------------------------------------------------- # Main #-------------------------------------------------- if [ x"$1" = x"start" ] then ReadConf if [ $? != 0 ] then exit 1 fi if [ "$ZONEWAIT" != 0 ] then WaitForZoneBoot if [ $? != 0 ] then exit 1 fi fi Start exit $? elif [ x"$1" = x"stop" ] then ReadConf if [ $? != 0 ] then exit 0 fi Stop exit $? else Pmsg ERROR "usage: $TAG {start|stop} [conffile]. cmd=$0 $*" fi exit 1
Content of the hvzonelifrsc.sh script file (if being used with fast switching mode for GLS or GS/SURE linkage mode)
#!/bin/sh # # hvzonelifrsc.sh 1.0 # LIF="" ZONENAME="" ZONEWAIT="" #-------------------------------------------------- # Place the logical interface in non-global zone #-------------------------------------------------- TAG=`/usr/bin/basename $0` CONFFILE=$2 RSCNAME=${HV_NODENAME:-Unknown} PHASE=${HV_INTENDED_STATE:-Unknown} Start() { IFCFG_RETRY_CNT=4 RET=1 CNT=0 while [ $RET -ne 0 ] && [ $CNT -le $IFCFG_RETRY_CNT ] do CNT=`/usr/bin/expr $CNT + 1` CMD="/usr/sbin/ifconfig $LIF zone $ZONENAME" Pmsg TRACE "$CMD" $CMD RET=$? Pmsg TRACE "exitcode = $RET" done if [ $RET -ne 0 ] then Pmsg ERROR "ifconfig failed. cmd=$CMD" fi return $RET } #-------------------------------------------------- # Place the logical interface in global zone #-------------------------------------------------- Stop() { IFCFG_RETRY_CNT=4 RET=1 CNT=0 while [ $RET -ne 0 ] && [ $CNT -le $IFCFG_RETRY_CNT ] do CNT=`/usr/bin/expr $CNT + 1` CMD="/usr/sbin/ifconfig $LIF -zone" Pmsg TRACE "$CMD" $CMD RET=$? Pmsg TRACE "exitcode = $RET" done return 0 } #-------------------------------------------------- # Common functions #-------------------------------------------------- WaitForZoneBoot() { MSGFLAG=0 while [ 1 ] do ZONESTATUS=`/usr/sbin/zoneadm -z "$ZONENAME" list -p 2>/dev/null | /bin/grep ":shared" |\ /usr/bin/nawk -F: '{ print $3 }'` if [ "$ZONESTATUS" = "ready" -o "$ZONESTATUS" = "running" ] then break fi if [ "$ZONESTATUS" = "" ] then Pmsg ERROR "shared-ip zone does not exist. ZONENAME=$ZONENAME" return 1 fi if [ "$MSGFLAG" = 0 ] then Pmsg INFO "wait for zone boot. stat=$ZONESTATUS ZONENAME=$ZONENAME" MSGFLAG=1 fi sleep 1 done if [ "$MSGFLAG" = 1 ] then Pmsg INFO "finished waiting. stat=$ZONESTATUS ZONENAME=$ZONENAME" fi return 0 } Pmsg() { TSTAMP=`/usr/bin/date +"%Y-%m-%d %H:%M:%S"` echo "$RSCNAME: $PHASE: $TSTAMP: $1: $TAG($$) $2" return 0 } ReadConf() { if [ -r "$CONFFILE" ] then . $CONFFILE fi if [ -z "$LIF" -o -z "$ZONENAME" ] then Pmsg ERROR "configuration error. LIF=$LIF ZONENAME=$ZONENAME" return 1 fi return 0 } #-------------------------------------------------- # Main #-------------------------------------------------- if [ x"$1" = x"start" ] then ReadConf if [ $? != 0 ] then exit 1 fi if [ "$ZONEWAIT" != 0 ] then WaitForZoneBoot if [ $? != 0 ] then exit 1 fi fi Start exit $? elif [ x"$1" = x"stop" ] then ReadConf if [ $? != 0 ] then exit 0 fi Stop exit $? else Pmsg ERROR "usage: $TAG {start|stop} [conffile]. cmd=$0 $*" fi exit 1
Create a new configuration file for the allocated script. Any file names can be specified. Moreover, set the following items for the created files.
Create configuration files of hvzonealip.sh (when using NIC switching mode of GLS, or GLS is not used)
Configure the five items; LIP, IPMASK, IFLIST, IPTYPE, and ZONENAME.
/var/tmp/PCL/rmstools/hvzonelip_zone-net.conf
LIP= IPMASK= IFLIST= IPTYPE= ZONENAME=
Create configuration files of hvzonelifrsc.sh (fast switching mode of GLS or GS/SURE linkage mode is used)
Configure two items, LIF and ZONENAME.
/var/tmp/PCL/rmstools/hvzonelifrsc_zone-net.conf
LIF= ZONENAME=
Item | Setting Details |
---|---|
Takeover IP Address (LIP=) | In the non-global zone, set up the takeover IP address. Set up for this IP address one that is not being used with GLS, takeover network resources, or other non-global zones. Since you need to consider that address characters may be omitted if you set an IPv6 adress, set the same address characters displayed when the ifconfig is executed while the IPv6 address is set for a network interface. Example: "192.168.10.10", "fd00:100::2e0:edff:fe0a:f30a" |
Netmask Length (IPMASK=) | Set the netmask length of LIP (for IPv4) or the prefix length (for IPv6). Example: "24", "64 |
List of Network Interface Names (IFLIST=) | Set up the name of the network interface which is on the global zone being used by the non-global zone. If linking multiple network interfaces with GLS, write both the primary and secondary network interfaces with a space separating them. |
Type of IP Address (IPTYPE=) | Set inet if LIP is IPv4 and set inet6 if LIP is IPv6. Example: "inet", "inet6" |
Takeover Logical Virtual Interface (LIF=) | In the non-global zone, set up the logical virtual interface (the interface with colons) for which the takeover IP address (IPv4 address) is allocated. |
Non-Global Zone Name (ZONENAME=) | Set up the name of the non-global zone. |
Non-Global Zones Wait | When allocating an IP address to a non-global zone, specify to check the status of the target non-global zone or not. If nothing is set, starting non-global zone is postponed untill TIMEOUT for Cmdline resource passes at a maximum. Without waiting, to make resources errors immediately, add "ZONEWAIT="0"" on the configuration file. |
Information
If using the NIC switching mode or GLS is not used, execute IP address takeover between the non-global zones by adding an IP address which differs from the takeover IP address registered to the Gls resource or the takeover network resource. However, if using fast switching mode or GS/SURE linkage mode, execute IP address takeover between the non-global zones by sharing with the global zone the takeover IP address registered to the Gls resource.
If using fast switching mode or GS/SURE linkage mode, set up the takeover logical virtual interface by adding the -i option to the hanethvrsc create command for GLS and executing this command. Also, by using the hanethvrsc print command, it is displayed as an ifname item.
# /opt/FJSVhanet/usr/sbin/hanethvrsc print ifname takeover-ipv4 takeover-ipv6 +----------+----------------+--------------------------------------------------+ sha0:65 192.168.100.101 -
If using the GS/SURE linkage mode, it is not possible to use the takeover IP address in non-global zone if one has performed setup without adding the -i option to the hanethvrsc create command for GLS. The takeover IP is for allocation to the virtual interface (shaX), not the logical virtual interface that can be shared between the non-global and global zones (shaX: 65). Determine if it was set up as a logical virtual interface by checking for a discrepancy between the takeover-ipv4 item displayed by executing hanethvrsc print and the virtual IP address for the Hostname item displayed by executing hanetconfig print.
# /opt/FJSVhanet/usr/sbin/hanethvrsc print ifname takeover-ipv4 takeover-ipv6 +----------+----------------+--------------------------------------------------+ sha0:65 192.168.100.101 - # /opt/FJSVhanet/usr/sbin/hanetconfig print [IPv4,Patrol] Name Hostname Mode MAC Adder/Phys ip Interface List +-----------+---------------+----+-----------------+---------------------------+ sha1 192.168.10.1 n fjgi0 sha2 192.168.20.1 n fjgi1 sha0 192.168.100.100 c sha1,sha2
Example
Example of setup of the NIC switching mode script
The setup example below is for if setting up the takeover address "192.168.10.10" in the non-global zone "zone1" by using the network interfaces "fjgi0 fjgi1" which the GLS NIC switching mode multiplied in the global zone.
/var/tmp/PCL/rmstools/hvzonelip_zone1-net1.conf
LIP="192.168.10.10" IPMASK="24" IFLIST="fjgi0 fjgi1" IPTYPE="inet" ZONENAME="zone1"
Example of setup of the script for if not using GLS
The setup example below is for if setting up the takeover IP address "fd00:100::2e0:edff:fe0a:f30a" in the non-global zone "zone1" by using the global zone network interface "fjgi0."
/var/tmp/PCL/rmstools/hvzonelip_zone1-net1.conf
LIP="fd00:100::2e0:edff:fe0a:f30a" IPMASK="64" IFLIST="fjgi0" IPTYPE="inet6" ZONENAME="zone1"
Example of setup of the fast switching script or GS/SURE linkage script
The setup example below is for if setting up the takeover logical virtual interface "sha0:65" in the non-global zone "zone1" by using the network interface multiplied by the GLS fast switching mode or GS/SURE linkage mode.
LIF="sha0:65" ZONENAME="zone1"
The created files for all nodes (global zone) which use Cmdline resources are copied.
Note
If a configuration file is not allocated for each node, Cmdline resources may not be started.
Register Cmdline resources.
Select "Path Input" from "Creation Method" for creating the Cmdline to configure the Start script and Stop script. No input is needed for Check script.
When using NIC switching mode of GLS, or not using GLS;
Start script
/var/tmp/PCL/rmstools/hvzonelip.sh start [config file]
Stop script
/var/tmp/PCL/rmstools/hvzonelip.sh stop [config file]
Check script
No input.
When using fast switching mode of GLS or using GS/SURE linkage mode;
Start script
/var/tmp/PCL/rmstools/hvzonelifrsc.sh start [config file]
Stop script
/var/tmp/PCL/rmstools/hvzonelifrsc.sh stop [config file]
Check script
No input.
The example are shown below.
Start script
/var/tmp/PCL/rmstools/hvzonelip.sh start /var/tmp/PCL/rmstools/hvzonelip_zone1-net1.conf
Stop script
/var/tmp/PCL/rmstools/hvzonelip.sh stop /var/tmp/PCL/rmstools/hvzonelip_zone1-net1.conf
Check script
No input.
Set attributes for scripts. Click the Flag button and set the following values.
Flag | Overview |
---|---|
NULLDETECTOR | Since there is no Check script, change this to "Yes." |
TIMEOUT | Change the default value from 300 seconds to 60 seconds. If making the TIMEOUT shorter than 60 seconds, set a value upon consideration of the execution time for the Start script and Stop script registered above. For details, refer to "6.7.1.1 Creating Cmdline Resources Creating Cmdline Resources." |
Note
Under the status of the non-global zones having been started up, make the Cmdline resource (shared IP control) into Online status. If the non-global zone is stopped, the shared zone IP zone setup using the ifconfig will fail.
If one wishes to start up the takeover IP address before the applications operating with the RMS on the non-global zone enter Online status, set up the associating of the Resource to the Cmdline resource (non-global zone control). Set up the Cmdline resource (shared IP control) to the subApplication for the Cmdline resource (non-global zone control). For details, refer to "6.7 Setting Up Cluster Applications."
In addition to the Gds resource, Gls resource, and Fsystem resource previously registered to the global zone, add the Cmdline resource created with Procedure "5-2. Creating the Cmdline Resource for Non-Global Zone Control" and create the cluster application corresponding to the target non-global zone.
Non-global zone should be stopped to create the cluster application. When the non-global zone is active, take the procedure below to stop the non-global zone that is controlled by the cluster application on all the cluster nodes, and then create the cluster application.
# zlogin zone-a shutdown -i0 -g0 -y
Check the cluster environment after creating the cluster applications. For details see "6.10 Checking the Cluster Environment."
Note
For the procedure for creating the cluster applications, follow "6.7.2.1 Creating Standby Cluster Applications." However, there is the following difference in procedure.
Cluster application attributes
If using warm-standby, be sure to always set the "Standby Transitions" to "ClearFaultRequest|StartUp|SwitchRequest."