Print this page
6865006 ldom validate shouldn't check for password file if migration type is set to normal
6864993 HA-xVM validate messages need to be wrapped by gettext

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ha-services/gds-agents/xvm/functions.ksh
          +++ new/usr/src/cmd/ha-services/gds-agents/xvm/functions.ksh
↓ open down ↓ 66 lines elided ↑ open up ↑
  67   67                case "${opt}" in
  68   68                   t) TAG=${OPTARG};;
  69   69                   p) PRI=${OPTARG};;
  70   70                esac
  71   71             done
  72   72        
  73   73             shift $((${OPTIND} - 1))
  74   74             LOG_STRING=$(/usr/bin/printf "$@")
  75   75             ${LOGGER} -p ${PRI} -t ${TAG} ${LOG_STRING}
  76   76          fi
       77 +}
  77   78  
  78      -        if [[ "${METHOD}" == "validate" ]]
  79      -        then
  80      -           shift 5
  81      -           /usr/bin/printf "$@"
  82      -        fi
       79 +i18n_message()
       80 +{
       81 +        debug_message "Function: i18n_message - Begin"
       82 +        ${DEBUG}
       83 +
       84 +        print -u2 $(/bin/printf "$@")
       85 +
       86 +        debug_message "Function: i18n_message - End"
       87 +        return 0
  83   88  }
  84   89  
  85   90  debug_message()
  86   91  {
  87   92          typeset DEBUG_TEXT=
  88   93     
  89   94          case ${DEBUG_LEVEL} in
  90   95             0)   # No debug msgs
  91   96                SET_DEBUG=
  92   97                ;;
↓ open down ↓ 114 lines elided ↑ open up ↑
 207  212     
 208  213          return ${rc}
 209  214  }
 210  215  
 211  216  validate_xvm()
 212  217  {
 213  218          debug_message "Function: validate_xvm - Begin"
 214  219          ${SET_DEBUG}
 215  220  
 216  221          typeset rc=0
      222 +        typeset msgtext
 217  223     
 218  224          if [ "$(/usr/bin/uname -i)" != "i86xpv" ]
 219  225          then
 220  226             # SCMSGS
 221  227             # @explanation
 222  228             # Solaris is not booted with xVM.
 223  229             # @user_action
 224  230             # Ensure that the default boot grub menu is set to boot
 225  231             # Solaris xVM.
 226  232             scds_syslog -p daemon.error -t $(syslog_tag) -m \
 227  233                  "Node is not booted with xVM."
 228  234  
      235 +           msgtext=$(gettext "Node is not booted with xVM.")
      236 +           i18n_message "${msgtext}" 
      237 +
 229  238             rc=1
 230  239          fi
 231  240  
 232  241          debug_message "Function: validate_xvm - End"
 233  242  
 234  243          return ${rc}
 235  244  }
 236  245  
 237  246  validate_ldom()
 238  247  {
 239  248          debug_message "Function: validate_ldom - Begin"
 240  249          ${SET_DEBUG}
 241  250  
 242  251          typeset ncount=0
      252 +        typeset msgtext
 243  253  
 244  254          # Make sure that the password file is readable.
 245      -        if [ ! -r "${PASSWORD_FILE}" ]
      255 +        if [[ ${MIGRATION_TYPE} != "NORMAL" ]]
 246  256          then
 247      -           # SCMSGS
 248      -           # @explanation
 249      -           # Incorrect Password file specified.
 250      -           # @user_action
 251      -           # Ensure that a valid password file is specified.
 252      -           scds_syslog -p daemon.error -t $(syslog_tag) -m \
 253      -              "Invalid password file specified %s." \
 254      -              "${PASSWORD_FILE}"
      257 +           if [ -z "${PASSWORD_FILE}" ]
      258 +           then
      259 +              # SCMSGS
      260 +              # @explanation
      261 +              # Password file cannot be null.
      262 +              # @user_action
      263 +              # Ensure that a password file name is specified.
      264 +              scds_syslog -p daemon.error -t $(syslog_tag) -m \
      265 +                 "Password file cannot be (null)."
 255  266  
 256      -           debug_message "Function: validate_ldom - End"
 257      -           return 1
      267 +              msgtext=$(gettext "Password file cannot be (null).")
      268 +              i18n_message "${msgtext}"
      269 +
      270 +              debug_message "Function: validate_ldom - End"
      271 +              return 1
      272 +           fi
      273 +
      274 +           if [[ ! -f "${PASSWORD_FILE}" ]] || [[ ! -r "${PASSWORD_FILE}" ]]
      275 +           then
      276 +              # SCMSGS
      277 +              # @explanation
      278 +              # Incorrect Password file specified.
      279 +              # @user_action
      280 +              # Ensure that a valid password file is specified.
      281 +              scds_syslog -p daemon.error -t $(syslog_tag) -m \
      282 +                 "Invalid password file specified %s." \
      283 +                 "${PASSWORD_FILE}"
      284 +
      285 +              msgtext=$(gettext "Invalid password file specified %s.")
      286 +              i18n_message "${msgtext}" "${PASSWORD_FILE}"
      287 +
      288 +              debug_message "Function: validate_ldom - End"
      289 +              return 1
      290 +           fi
 258  291          fi
 259  292          
 260  293          # Ensure that the control domain is a cluster node.
 261  294          if ! ${LDM} ls > /dev/null 2>&1
 262  295          then
 263  296             # SCMSGS
 264  297             # @explanation
 265  298             # Self explanatory.
 266  299             # @user_action
 267  300             # Ensure that the resource is configured in
 268  301             # control domain.
 269  302             scds_syslog -p daemon.error -t $(syslog_tag) -m \
 270  303                 "The LDom Manager is running in configuration mode."
 271  304  
 272      -              debug_message "Function: validate_ldom - End"
      305 +           msgtext=$(gettext "The LDom Manager is running in configuration mode.")
      306 +           i18n_message "${msgtext}"
      307 +
      308 +           debug_message "Function: validate_ldom - End"
 273  309             return 1
 274  310          fi
 275  311  
 276  312          # Ensure that the failure-policy setting is set to "reset".
 277  313          # If the control domain fails,this would allow the guest domains
 278  314          # to panic. 
 279  315          policy=$(${LDM} list -o domain primary \
 280  316              | ${AWK} -F"=" '$1~/failure-policy/ {print $2}')
 281  317  
 282  318          if [ "${policy}" != "reset" ]
↓ open down ↓ 1 lines elided ↑ open up ↑
 284  320             # SCMSGS
 285  321             # @explanation
 286  322             # Incorrect failure-policy setting for the domain.
 287  323             # @user_action
 288  324             # Ensure that the failure-policy for the domain is
 289  325             # set to "reset" on the control domain.
 290  326             scds_syslog -p daemon.error -t $(syslog_tag) -m \
 291  327                "Invalid failure policy \"%s\" for %s domain." \
 292  328                "${policy}" "primary"
 293  329  
      330 +           msgtext=$(gettext "Invalid failure policy \"%s\" for %s domain.")
      331 +           i18n_message "${msgtext}" "${policy}" "primary"
      332 +
 294  333             debug_message "Function: validate_ldom - End"
 295  334             return 1
 296  335          fi
 297  336  
 298  337          # The CL_EXEC_CLIENT program executes a command on any of the 
 299  338          # cluster nodes or a zone or in a zone cluster. It then generates
 300  339          # as output the exit status of command and the stdout and stderr
 301  340          # messages. The valid options are:
 302  341          #     [ -z zoneclustername] The command is run on the zone cluster
 303  342          # represented by the zonename.
↓ open down ↓ 8 lines elided ↑ open up ↑
 312  351          for nodename in $(${SCHA_RESOURCEGROUP_GET} -O NODELIST -G ${RESOURCEGROUP})
 313  352          do
 314  353             if [[ "$(${SCHA_CLUSTER_GET} -O NodeState_Node ${nodename})" == "DOWN" ]]
 315  354             then
 316  355                continue
 317  356             fi
 318  357  
 319  358             nodeid=$(${SCHA_CLUSTER_GET} -O NODEID_NODENAME ${nodename})
 320  359             output=$(${CL_EXEC_CLIENT} -n ${nodeid} -c "${LDM} list-domain ${DOMAIN}")
 321  360             result=${?}
 322      -
 323  361             status=$(echo ${output} | ${AWK} '{print $6}')
 324  362  
 325  363             if (( ${result} == 0 )) && (( ${status} == 0 ))
 326  364             then
 327  365                domstate=$(echo $output | ${AWK} -F" " '{print $18}')     
 328  366  
 329  367                if (( ${update} == 0)) && echo $domstate | ${GREP} -q -E "^active$|suspending|resuming|suspended|starting" > /dev/null 2>&1
 330  368                then
 331  369                   # SCMSGS
 332  370                   # @explanation
 333  371                   # The domain is in an invalid state.
 334  372                   # @user_action
 335  373                   # Ensure that the domain is in inactive or bound state.
 336  374                   scds_syslog -p daemon.error -t $(syslog_tag) -m \
 337  375                      "Domain %s is in %s state on %s." \
 338  376                      "${DOMAIN}" "${domstate}" "${nodename}"
 339  377  
      378 +                   msgtext=$(gettext "Domain %s is in %s state on %s.")
      379 +                   i18n_message "${msgtext}" "${DOMAIN}" "${domstate}" "${nodename}"
      380 +
 340  381                   debug_message "Function: validate_ldom - End"
 341  382                   return 1
 342  383                fi
 343  384  
 344  385                ncount=$((ncount+1))
 345  386                nlist=$(echo ${nodename} ${nlist})
 346  387  
 347  388                # dump domain confguration to ccr
 348  389                if [[ "$(/usr/bin/hostname)" == "${nodename}" ]]
 349  390                then
↓ open down ↓ 6 lines elided ↑ open up ↑
 356  397              fi
 357  398          done
 358  399  
 359  400          if (( ${ncount} == 0 ))
 360  401          then
 361  402             if ! ${CCRADM} showkey --key xml_${RESOURCE} ${CCR_TABLE} > /dev/null 2>&1
 362  403             then
 363  404                scds_syslog -p daemon.error -t $(syslog_tag) -m \
 364  405                   "Domain %s does not exist." \
 365  406                   "${DOMAIN}"
      407 +
      408 +              msgtext=$(gettext "Domain %s does not exist.")
      409 +              i18n_message "${msgtext}" "${DOMAIN}"
      410 +
 366  411                return 1
 367  412             fi
 368  413          fi
 369  414  
 370  415          if [[ ${ncount} -gt 1 ]]
 371  416          then
 372  417             # SCMSGS
 373  418             # @explanation
 374  419             # The domain is configured on multiple 
 375  420             # cluster nodes.
 376  421             # @user_action
 377  422             # Ensure that the domain is configured on one node
 378  423             # of the cluster.
 379  424             scds_syslog -p daemon.error -t $(syslog_tag) -m \
 380  425                "Multiple domain %s configuration exists on %s." \
 381  426                "${DOMAIN}" "${nlist}"
      427 +
      428 +              msgtext=$(gettext "Multiple domain %s configuration exists on %s.")
      429 +              i18n_message "${msgtext}" "${DOMAIN}" "${nlist}"
      430 +
 382  431             return 1
 383  432          fi
 384  433  
 385  434          debug_message "Function: validate_ldom - End"
 386  435          return 0
 387  436  }
 388  437  
 389  438  validate()
 390  439  {
 391  440          debug_message "Function: validate - Begin"
↓ open down ↓ 8 lines elided ↑ open up ↑
 400  449             then
 401  450                 # SCMSGS
 402  451                 # @explanation
 403  452                 # Incorrect user probe file specified.
 404  453                 # @user_action
 405  454                 # Ensure that a valid user probe file is specified.
 406  455                 scds_syslog -p daemon.error -t $(syslog_tag) -m \
 407  456                     "Invalid user probe file %s." \
 408  457                     "${PLUGIN_PROBE}"
 409  458  
      459 +               msgtext=$(gettext "Invalid user probe file %s.")
      460 +               i18n_message "${msgtext}" "${PLUGIN_PROBE}"
      461 +
 410  462                 return 1
 411  463             fi
 412  464          fi
 413  465     
 414  466          validate_${VM}
 415  467          rc=${?}   
 416  468  
 417  469          debug_message "Function: validate - End"
 418  470          return ${rc}
 419  471  }
↓ open down ↓ 1458 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX