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 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
24 #
25 #ident "%Z%%M% %I% %E% SMI"
26 #
27
28 MYNAME=$(basename ${0})
29 MYDIR=$(dirname ${0})
30 METHOD="validate"
31 MACH="$(/usr/bin/uname -p)"
32
33 typeset -rx TEXTDOMAIN=SUNW_SC_XVM
34 typeset -rx TEXTDOMAINDIR=/opt/SUNWscxvm/lib/locale
35
36 case "${MACH}" in
37 i386*)
38 VM=xvm
39 PROPS="Domain_name Migration_type Plugin_probe Debug_level"
40 ;;
41 sparc*)
42 VM=ldom
43 PROPS="Domain_name Migration_type Plugin_probe Password_file Debug_level"
44 ;;
45 *)
46 ;;
47 esac
48
49 . ${MYDIR}/functions
50
51 typeset opt
52 typeset -i rc=0
53 typeset -i update=0
54
55 while getopts 'cur:x:X:g:R:G:T:' opt
56 do
57 case "${opt}" in
58 u) # set update
59 update=1
60 ;;
61 x) # Extension properties
62 property_key=$(echo ${OPTARG} | ${AWK} -F= '{print $1}' | ${TR} [a-z] [A-Z])
63 property_value=$(echo ${OPTARG} | ${AWK} -F= '{print $2}')
64
65 case "${property_key}" in
66 DOMAIN_NAME) DOMAIN=${property_value};;
67 MIGRATION_TYPE) MIGRATION_TYPE=${property_value};;
68 PLUGIN_PROBE) PLUGIN_PROBE=${property_value};;
69 PASSWORD_FILE) PASSWORD_FILE=${property_value};;
70 DEBUG_LEVEL) DEBUG_LEVEL=${property_value};;
71 esac
72 ;;
73
74 X) # Per_node extension properties
75 ;;
76
77 g) # Resource group properties
78 ;;
79
80 R) RESOURCE=${OPTARG};;
81
82 G) RESOURCEGROUP=${OPTARG};;
83
84 T) RESOURCETYPE=${OPTARG};;
85
86 esac
87 done
88
89 if [[ ${update} == 1 ]]
90 then
91 if ! get_properties ${PROPS}
92 then
93 debug_message "Method: $(basename ${0}) - End (Exit 1)"
94 exit 1
95 fi
96 fi
97
98 debug_message "Method: $(basename ${0}) - Begin"
99 $SET_DEBUG
100
101 if ! validate
102 then
103 debug_message "Method: $(basename ${0}) - End (Exit 1)"
104 exit 1
105 fi
106
107 debug_message "Method: $(basename ${0}) - End (Exit 0)"
108
109 exit 0