Print this page
Split Close
Expand all
Collapse all
          --- /workspace/tf84964/oscds-s9-zone/webrev/usr/src/cmd/ha-services/gds-agents/zone/sczbt/functions.ksh-
          +++ functions.ksh
↓ open down ↓ 255 lines elided ↑ open up ↑
 256  256                                                          # got really setup with
 257  257                                                          # brand type "lx".
 258  258                                                          scds_syslog -p daemon.err \
 259  259                                                            -t $(syslog_tag) -m \
 260  260                                                            "Function: validate - Zonebrand for zone %s is configured as lx, but the zone is configured as brand type %s." \
 261  261                                                            "${Zonename}" "${ZONE_BRAND}"
 262  262                                                          rc_validate=1
 263  263                                                  fi
 264  264                                          fi;;
 265  265  
 266      -                                solaris8)
      266 +                                solaris8|solaris9)
 267  267                                          debug_message "Function: validate - Zonebrand configured as ${Zonebrand}"
 268  268                                          if [ "`/usr/bin/uname -p`" != "sparc" ]; then
 269  269                                                          # SCMSGS
 270  270                                                          # @explanation
 271      -                                                        # The solaris8 brand for
      271 +                                                        # The solaris8 and
      272 +                                                        # solaris9 brand for
 272  273                                                          # zones is only
 273  274                                                          # supported on the
 274  275                                                          # sparc platform.
 275  276                                                          # @user_action
 276  277                                                          # Review the components
 277  278                                                          # configuration file and
 278  279                                                          # make sure the variable
 279  280                                                          # Zonebrand defines
 280      -                                                        # "solaris8" only on a
      281 +                                                        # "solaris8" or
      282 +                                                        # "solaris9" only on a
 281  283                                                          # sparc system.
 282  284                                                          scds_syslog -p daemon.err \
 283  285                                                            -t $(syslog_tag) -m \
 284  286                                                            "Function: validate - Zonebrand for zone %s is configured as %s on a non-sparc system. It is only supported on sparc systems." \
 285  287                                                            "${Zonename}" "${Zonebrand}"
 286  288                                                          rc_validate=1
 287  289                                          else
 288  290                                                  ZONE_BRAND=`${ZONECFG} -z ${Zonename} info | /bin/grep "^brand:" | /bin/awk '{print $2}'`
 289      -                                                if [ "${ZONE_BRAND}" = "solaris8" ]; then
      291 +                                                if [ "${ZONE_BRAND}" = "${Zonebrand}" ]; then
 290  292                                                          debug_message "Function: validate - Zonebrand verified as being ${ZONE_BRAND}"
 291  293                                                  else
 292  294                                                          # SCMSGS
 293  295                                                          # @explanation
 294  296                                                          # Zonebrand is set to
 295      -                                                        # "solaris8". But the
      297 +                                                        # "solaris8" or
      298 +                                                        # "solaris9". But the
 296  299                                                          # Zone is not configured
 297  300                                                          # as brand type solaris8
      301 +                                                        # or solaris9
 298  302                                                          # according to zonecfg
 299  303                                                          # info.
 300  304                                                          # @user_action
 301  305                                                          # Review the components
 302  306                                                          # configuration file and
 303  307                                                          # make sure the variable
 304  308                                                          # Zonebrand defines
 305      -                                                        # "solaris8" only for a
      309 +                                                        # "solaris8" or
      310 +                                                        # "solaris9" only for a
 306  311                                                          # Zone that got really
 307  312                                                          # setup with brand type
 308      -                                                        # "solaris8".
      313 +                                                        # "solaris8" or
      314 +                                                        # "solaris9".
 309  315                                                          scds_syslog -p daemon.err \
 310  316                                                            -t $(syslog_tag) -m \
 311      -                                                          "Function: validate - Zonebrand for zone %s is configured as solaris8, but the zone is configured as brand type %s." \
 312      -                                                          "${Zonename}" "${ZONE_BRAND}"
      317 +                                                          "Function: validate - Zonebrand for zone %s is configured as %s, but the zone is configured as brand type %s." \
      318 +                                                          "${Zonename}" "${Zonebrand}" "${ZONE_BRAND}"
 313  319                                                          rc_validate=1
 314  320                                                  fi
 315  321                                          fi;;
 316  322  
 317  323                                  *)
 318  324                                                  # SCMSGS
 319  325                                                  # @explanation
 320  326                                                  # Currently Zonebrand can only
 321  327                                                  # be set to "native", "lx" or
 322  328                                                  # "solaris8".
 323  329                                                  # @user_action
 324  330                                                  # Review the components
 325  331                                                  # configuration file and make
 326  332                                                  # sure the variable Zonebrand
 327  333                                                  # defines either "native", "lx"
 328  334                                                  # or "solaris8".
 329  335                                                  scds_syslog -p daemon.err \
 330  336                                                    -t $(syslog_tag) -m \
 331      -                                                  "Function: validate - Zonebrand for zone %s is configured as %s. Valid values are native, lx and solaris8." \
      337 +                                                  "Function: validate - Zonebrand for zone %s is configured as %s. Valid values are native, lx, solaris8 and solaris9." \
 332  338                                                    "${Zonename}" "${Zonebrand}"
 333  339                                                  rc_validate=1;;
 334  340                          esac;;
 335  341  
 336  342                          Zonebootopt)
 337  343  
 338  344                          # test the Zones boot options
 339  345  
 340  346                          # is the Zone boot option specified and a supported one
 341  347  
↓ open down ↓ 51 lines elided ↑ open up ↑
 393  399                                  scds_syslog -p daemon.err -t $(syslog_tag) -m \
 394  400                                    "Function: validate - LXrunlevel not set in %s" \
 395  401                                    "${PARFILE}"
 396  402                                  rc_validate=1
 397  403                          else
 398  404                                  debug_message "Function: validate - LXrunlevel (${LXrunlevel}) set"
 399  405                          fi;;
 400  406  
 401  407                          SLrunlevel)
 402  408  
 403      -                        # verify that SLrunlevel is setup if Zonebrand="solaris8"
      409 +                        # verify that SLrunlevel is setup if Zonebrand is set
      410 +                        # to "solaris8" or "solaris9"
 404  411  
 405      -                        if [ -z "${SLrunlevel}" ] && [ "${Zonebrand}" = "solaris8" ]; then
      412 +                        if [ -z "${SLrunlevel}" ] && [ "${Zonebrand}" = "solaris8" -o "${Zonebrand}" = "solaris9" ]; then
 406  413                                  # SCMSGS
 407  414                                  # @explanation
 408  415                                  # The SLrunlevel variable is not set in the
 409  416                                  # parameter file sczbt_<resource name>.
 410  417                                  # @user_action
 411  418                                  # Set the SLrunlevel variable in the parameter
 412  419                                  # file sczbt_<resource name>.
 413  420                                  scds_syslog -p daemon.err -t $(syslog_tag) -m \
 414  421                                    "Function: validate - SLrunlevel not set in %s" \
 415  422                                    "${PARFILE}"
↓ open down ↓ 188 lines elided ↑ open up ↑
 604  611                                  # Correct the LXrunlevel variable in the
 605  612                                  # paramter file sczbt_<resource name>. You need
 606  613                                  # to specify "unknown" together with the boot
 607  614                                  # option -s.
 608  615                                  scds_syslog -p daemon.err -t $(syslog_tag) -m \
 609  616                                    "Function: validate - LXrunlevel (%s) is invalid with Zonebootopt=%s, needs single-user" \
 610  617                                    "${LXrunlevel}" "${Zonebootopt}"
 611  618                                  rc_validate=1
 612  619                          fi;;
 613  620  
 614      -                   solaris8)
      621 +                   solaris8|solaris9)
 615  622                          if [ "${SLrunlevel}" != "S" ]
 616  623                          then
 617  624                                  # SCMSGS
 618  625                                  # @explanation
 619  626                                  # The Zoneboot variable is set to -s. Every
 620  627                                  # SLrunlevel other than "S" is invalid.
 621  628                                  # @user_action
 622  629                                  # Correct the SLrunlevel variable in the
 623  630                                  # paramter file sczbt_<resource name>. You need
 624  631                                  # to specify "S" together with the boot
↓ open down ↓ 267 lines elided ↑ open up ↑
 892  899  
 893  900  start_sczbt()
 894  901  {
 895  902          #
 896  903          # Start sczbt
 897  904          #
 898  905  
 899  906          debug_message "Function: start_sczbt - Begin"
 900  907          ${SET_DEBUG}
 901  908  
 902      -        # If the zone is of brand type "solaris8" and if the platform changed
 903      -        # from where the zone was previously started, the s8_p2v script needs
 904      -        # to get called prior boot to make sure that any platform specific
 905      -        # libraries are properly setup within the zone rootpath.
      909 +        # If the zone is of brand type "solaris8" or "solaris9" and if the
      910 +        # platform changed from where the zone was previously started,
      911 +        # the s8_p2v or s9_p2v script needs to get called prior boot to make
      912 +        # sure that any platform specific libraries are properly setup within
      913 +        # the zone rootpath.
 906  914          # The script needs to run only once per new platform. The file
 907      -        # .platform.orig stores the platform names for which the s8_p2v script
 908      -        # had already run. Only if a new platform gets introduced into the
 909      -        # cluster, the s8_p2v script gets called on that node again.
 910      -        if [ "${Zonebrand}" = "solaris8" ]; then
      915 +        # .platform.orig stores the platform names for which the s8_p2v or
      916 +        # s9_p2v script had already run. Only if a new platform gets introduced
      917 +        # into the cluster, the s8_p2v or s9_p2v script gets called on that
      918 +        # node again.
      919 +        if [ "${Zonebrand}" = "solaris8" -o "${Zonebrand}" = "solaris9" ]; then
 911  920  
      921 +                case ${Zonebrand} in
      922 +                        solaris8)
      923 +                                P2V_SCRIPT=/usr/lib/brand/solaris8/s8_p2v
      924 +                                ;;
      925 +                        solaris9)
      926 +                                P2V_SCRIPT=/usr/lib/brand/solaris9/s9_p2v
      927 +                                ;;
      928 +                esac
      929 +
 912  930                  get_zonepath ${Zonename}
 913  931  
 914  932                  myplatform=`/bin/uname -i`
 915  933                  myplatformfile=${Zonepath}/root/.platform.orig
 916      -                need_s8_p2v=true
      934 +                need_p2v=true
 917  935  
 918  936                  # if there is no .platform.orig file or if the current
 919  937                  # platform is not contained, s8_p2v needs to run
 920  938                  if [ -f ${myplatformfile} ]; then
 921  939  
 922  940                          if /usr/bin/grep "^${myplatform}$" ${myplatformfile} > /dev/null 2>&1
 923  941                          then
 924      -                                need_s8_p2v=false
      942 +                                need_p2v=false
 925  943                          fi
 926  944                  fi
 927  945                  
 928      -                if [ -x /usr/lib/brand/solaris8/s8_p2v -a "${need_s8_p2v}" = "true" ]; then
 929      -                        /usr/lib/brand/solaris8/s8_p2v ${Zonename} >${LOGFILE} 2>&1
      946 +                if [ -x "${P2V_SCRIPT}" -a "${need_p2v}" = "true" ]; then
      947 +                        ${P2V_SCRIPT} ${Zonename} >${LOGFILE} 2>&1
 930  948                          if [ $? -ne 0 ]; then
 931  949                                  # SCMSGS
 932  950                                  # @explanation
 933  951                                  # Unable to perform platform specific
 934      -                                # setup for the solaris8 zone.
      952 +                                # setup for the solaris8 or solaris9 zone.
 935  953                                  # @user_action
 936  954                                  # Disable the resource and manually run
 937      -                                # the /usr/lib/brand/solaris8/s8_p2v
 938      -                                # <zonename> command on the node where
 939      -                                # the start failed. Correct any errors
 940      -                                # reported, then restart the resource.
      955 +                                # '/usr/lib/brand/solaris8/s8_p2v 
      956 +                                # <zonename>' for solaris8 or
      957 +                                # '/usr/lib/brand/solaris9/s9_p2v <zonename>'
      958 +                                # for solaris9 on the node where the start
      959 +                                # failed. Correct any errors reported, then
      960 +                                # restart the resource.
 941  961                                  scds_syslog -p daemon.err -t $(syslog_tag) -m \
 942      -                                        "Function: start_sczbt - Running command /usr/lib/brand/solaris8/s8_p2v %s failed. Unable to start zone." \
 943      -                                        "${Zonename}"
      962 +                                        "Function: start_sczbt - Running command %s %s failed. Unable to start zone." \
      963 +                                        "${P2V_SCRIPT}" "${Zonename}"
 944  964                                  rc_start_command=1
 945  965                                  return 1
 946  966                          fi
 947  967  
 948  968                          # Only update the file if it is not a symbolic link.
 949  969                          # Otherwise it would be a security issue.
 950  970                          if [ ! -h ${myplatformfile} ]; then
 951  971                                  # Add platform to the .platform.orig file
 952  972                                  echo ${myplatform} >> ${myplatformfile}
 953  973                          fi
 954  974                  fi
 955  975  
 956  976                  # Only update the file if it is not a symbolic link.
 957  977                  # Otherwise it would be a security issue.
 958  978                  if [ ! -h ${Zonepath}/root/.host.orig ]; then
 959  979                          # This update is necessary to make sure the
 960      -                        # solaris8 zone can get booted without manual
 961      -                        # intervention.
      980 +                        # solaris8 or solaris9 zone can get booted without
      981 +                        # manual intervention.
 962  982                          /usr/bin/hostid > ${Zonepath}/root/.host.orig
 963  983                  fi
 964  984          fi
 965  985  
 966  986          # boot the zone
 967  987          ${ZONEADM} -z ${Zonename} boot ${Zonebootopt} >>${LOGFILE} 2>&1
 968  988  
 969  989          rc_start_command=${?}
 970  990  
 971  991          # disable the pmf tag and run a sleep in the background, to assure, that there will be a valid pmftag during the start phase
↓ open down ↓ 146 lines elided ↑ open up ↑
1118 1138                                                          fi
1119 1139                                                  fi
1120 1140                                          done
1121 1141                                  done
1122 1142                          done
1123 1143                  done
1124 1144          fi
1125 1145  
1126 1146          # bring down the zone
1127 1147          debug_message "Function: stop_sczbt - Shuting down non-global zone ${Zonename}"
1128      -        if [ "${Zonebrand}" = "native" -o "${Zonebrand}" = "solaris8" ]; then
1129      -                ${ZLOGIN} ${Zonename} /usr/sbin/shutdown -y -g0 -i0 >${LOGFILE} 2>&1
1130      -        else
1131      -                # we must be an "lx" brand
1132      -                ${ZLOGIN} ${Zonename} /sbin/shutdown -h now >${LOGFILE} 2>&1
1133      -        fi
     1148 +        case ${Zonebrand} in
     1149 +                native|solaris8|solaris9)
     1150 +                        ${ZLOGIN} ${Zonename} /usr/sbin/shutdown -y -g0 -i0 >${LOGFILE} 2>&1
     1151 +                        ;;
     1152 +                lx)
     1153 +                        ${ZLOGIN} ${Zonename} /sbin/shutdown -h now >${LOGFILE} 2>&1
     1154 +                        ;;
     1155 +        esac
1134 1156  
1135 1157          #
1136 1158          # run a test loop to determine if the zone reached state "installed"
1137 1159          # or if the timeout for proper shutdown is exceeded
1138 1160          #
1139 1161          while  [ ${SECONDS} -lt ${MAX_STOP_TIMEOUT} ]
1140 1162          do
1141 1163                  # check if the zone reached state "installed"
1142 1164                  get_zone_state ${Zonename}
1143 1165                  debug_message "Function: stop_sczbt - ${Zonename} state is ${ZONE_STATE}, time passed while waiting for shutdown: ${SECONDS}"
↓ open down ↓ 151 lines elided ↑ open up ↑
1295 1317                                          rc_check_sczbt=100
1296 1318                                          debug_message "Function: check_sczbt - ${Zonename} runlevel (${LXrunlevel}) state is ${LX_STATE}"
1297 1319                                          return ${rc_check_sczbt}
1298 1320                                  fi
1299 1321                          else
1300 1322                                  rc_check_sczbt=100
1301 1323                                  debug_message "Function: check_sczbt - runlevel did not return successfully (return code ${rc_get_lx_state}) for the non-global zone {Zonename}"
1302 1324                                  return ${rc_check_sczbt}
1303 1325                          fi;;
1304 1326  
1305      -                   solaris8)
     1327 +                   solaris8|solaris9)
1306 1328                          if get_solaris_legacy_state ${Zonename}
1307 1329                          then
1308 1330                                  if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]
1309 1331                                  then
1310 1332                                          rc_check_sczbt=100
1311 1333                                          debug_message "Function: check_sczbt - ${Zonename} runlevel (${SLrunlevel}) state is ${SOLARIS_LEGACY_STATE}"
1312 1334                                          return ${rc_check_sczbt}
1313 1335                                  fi
1314 1336                          else
1315 1337                                  rc_check_sczbt=100
↓ open down ↓ 130 lines elided ↑ open up ↑
1446 1468                                          # @user_action
1447 1469                                          # None.
1448 1470                                          scds_syslog -p daemon.err -t $(syslog_tag) -m \
1449 1471                                                  "Function: check_sczbt - runlevel did not run successfully (return code %s) in the non-global zone %s, try again in 5 seconds" \
1450 1472                                                  "${rc_get_lx_state}" "${Zonename}"
1451 1473                                          rc_check_sczbt=100
1452 1474                                          sleep 5
1453 1475                                  fi
1454 1476                          done;;
1455 1477  
1456      -                   solaris8)
     1478 +                   solaris8|solaris9)
1457 1479                          while [ ${SECONDS} -lt ${MAX_PROBE_TIMEOUT} ]
1458 1480                          do
1459 1481                                  if get_solaris_legacy_state ${Zonename}
1460 1482                                  then
1461 1483                                          if [ "${SOLARIS_LEGACY_STATE}" != "${SLrunlevel}" ]
1462 1484                                          then
1463 1485                                                  # SCMSGS
1464 1486                                                  # @explanation
1465 1487                                                  # The legacy runlevel is not
1466 1488                                                  # equal to the configured
↓ open down ↓ 36 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX