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 case "${MACH}" in
  34     i386*)
  35            VM=xvm
  36            PROPS="Domain_name Migration_type Plugin_probe Debug_level"
  37         ;;
  38    sparc*)
  39            VM=ldom
  40            PROPS="Domain_name Migration_type Plugin_probe Password_file Debug_level"
  41         ;;
  42         *)
  43         ;;
  44 esac
  45 
  46 . ${MYDIR}/functions
  47 
  48 typeset opt
  49 typeset -i rc=0
  50 typeset -i update=0
  51 
  52 while getopts 'cur:x:X:g:R:G:T:' opt
  53 do
  54     case "${opt}" in
  55         u)  # set update 
  56             update=1
  57             ;;
  58         x)  # Extension properties
  59             property_key=$(echo ${OPTARG} | ${AWK} -F= '{print $1}' | ${TR} [a-z] [A-Z])
  60             property_value=$(echo ${OPTARG} | ${AWK} -F= '{print $2}')
  61 
  62             case "${property_key}" in 
  63                 DOMAIN_NAME)    DOMAIN=${property_value};;
  64                 MIGRATION_TYPE) MIGRATION_TYPE=${property_value};;
  65                 PLUGIN_PROBE)   PLUGIN_PROBE=${property_value};;
  66                 PASSWORD_FILE)  PASSWORD_FILE=${property_value};;
  67                 DEBUG_LEVEL)    DEBUG_LEVEL=${property_value};;
  68             esac
  69             ;;
  70 
  71         X)  # Per_node extension properties
  72             ;;
  73 
  74         g)  # Resource group properties
  75             ;;
  76 
  77         R)  RESOURCE=${OPTARG};;
  78 
  79         G)  RESOURCEGROUP=${OPTARG};;
  80 
  81         T)  RESOURCETYPE=${OPTARG};;
  82 
  83     esac
  84 done
  85 
  86 if [[ ${update} == 1 ]]
  87 then
  88         if ! get_properties ${PROPS}
  89         then
  90                 debug_message "Method: $(basename ${0}) - End (Exit 1)"
  91                 exit 1
  92         fi
  93 fi
  94 
  95 debug_message "Method: $(basename ${0}) - Begin"
  96 $SET_DEBUG
  97 
  98 if ! validate
  99 then
 100         debug_message "Method: $(basename ${0}) - End (Exit 1)"
 101         exit 1
 102 fi
 103 
 104 debug_message "Method: $(basename ${0}) - End (Exit 0)"
 105 
 106 exit 0