New control_xvm
1 #!/usr/bin/ksh
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/CDDL.txt
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/CDDL.txt.
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 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
24 #
25 #ident "@(#)control_xvm 1.2 08/02/15 SMI"
26 #
27 # Usage GDS: <options> <parameter1>
28 #
29 # <options>: -R <resource> -G <resourcegroup> etc.
30 # parameter1: start | stop | probe | validate
31
32 MYNAME=`/usr/bin/basename $0`
33 MYDIR=`/usr/bin/dirname $0`
34
35 . ${MYDIR}/../etc/config
36
37 typeset opt
38
39 while getopts 'R:G:D:P:M:' opt
40 do
41 case "${opt}" in
42 R) RESOURCE=${OPTARG};;
43 G) RESOURCEGROUP=${OPTARG};;
44 D) DOMAIN=${OPTARG};;
45 P) DOMAIN_PATHNAME=${OPTARG};;
46 M) FAILOVER_TYPE=${OPTARG};;
47 *) exit 1;;
48 esac
49 done
50
51 shift $((${OPTIND} -1))
52
53 METHOD=${1}
54
55 . ${MYDIR}/functions
56
57 # Perform all the scha* calls
58
59 if [ "${METHOD}" = "start" ]
60 then
61 START_TIMEOUT=$(/usr/cluster/bin/scha_resource_get -O START_TIMEOUT \
62 -R ${RESOURCE} -G ${RESOURCEGROUP} )
63 fi
64
65 if [ "${METHOD}" = "stop" ]
66 then
67 STOP_TIMEOUT=$(/usr/cluster/bin/scha_resource_get -O STOP_TIMEOUT \
68 -R ${RESOURCE} -G ${RESOURCEGROUP} )
69 fi
70
71 debug_message "Method: ${MYNAME} - Begin"
72 ${SET_DEBUG}
73
74 case "${METHOD}" in
75 start)
76 start_domain
77 rc=$?
78 ;;
79
80 stop)
81 check_domain
82 rc=$?
83 [[ "${rc}" -eq 0 ]] && stop_domain
84 rc=$?
85 ;;
86
87 probe)
88 check_domain
89 rc=$?
90 ;;
91 validate)
92 validate
93 rc=$?
94 ;;
95 esac
96
97 debug_message "Method: ${MYNAME} - End"
98 exit ${rc}