Home | History | Annotate | Download | only in man1ha
 te
CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at CDDL.txt
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at CDDL.txt.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END
Copyright 2008 Sun Microsystems, Inc. All rights
reserved. Use is subject to license terms.
scha_resource_get 1HA "19 Aug 2008" "Sun Cluster 3.2" "Sun Cluster Commands"
NAME
scha_resource_get - access resource information
SYNOPSIS

scha_resource_get [-Q] -O optag -R resource [-G group]
[args]
DESCRIPTION

The scha_resource_get command accesses information about a resource that is under the control of the Resource Group Manager (RGM). You can use this command to query the properties of the resource's type, as described in rt_properties(5), as well as the properties of the resource, as described in r_properties(5).

Use the scha_resource_get command in shell script implementations of the callback methods for resource types that represent services that are controlled by the cluster's RGM. This command provides the same information as the scha_resource_get(3HA) C function.

Information is generated by the command to stdout in formatted strings on separate lines, as described in scha_cmds(1HA). The output can be stored in shell variables and parsed by using shell facilities or awk(1) for further use by the script.

You need solaris.cluster.resource.read role-based access control (RBAC) authorization to use this command. See rbac(5).

You must also be able to assume a role to which the Sun Cluster Commands rights profile has been assigned to use this command. Authorized users can issue privileged Sun Cluster commands on the command line from the pfsh(1), pfcsh(1), or pfksh(1) profile shell. A profile shell is a special kind of shell that enables you to access privileged Sun Cluster commands that are assigned to the Sun Cluster Commands rights profile. A profile shell is launched when you run su(1M) to assume a role. You can also use pfexec(1) to issue privileged Sun Cluster commands.

OPTIONS

The following options are supported:

.na -G group .ad The name of the resource group in which the resource has been configured. Although this argument is optional, the command will run more efficiently if you include it.

.na -O optag .ad Indicates the information to be accessed. Depending on the optag value that you specify, you might need to include an additional value to indicate the cluster node or zone for which information is to be retrieved.

Note - optag values, such as AFFINITY_TIMEOUT and BOOT_TIMEOUT, are not case sensitive. You can use any combination of uppercase and lowercase letters when you specify optag values. The following optag values retrieve the corresponding resource properties. The value of the named property of the resource is generated. The NUM_RG_RESTARTS, NUM_RESOURCE_RESTARTS, MONITORED_SWITCH, ON_OFF_SWITCH, RESOURCE_STATE, and STATUS properties refer to the value on the node or zone where the command is executed. See the r_properties(5) man page for descriptions of the resource properties that correspond to the following optag values. Note that some optag values in the following list are described after the list rather than in the r_properties(5) man page. The EXTENSION property also refers to the value on the node or zone where the command is executed, provided that the PER_NODE property attribute is set. See the property_attributes(5) man page.

AFFINITY_TIMEOUT
ALL_EXTENSIONS
BOOT_TIMEOUT
CHEAP_PROBE_INTERVAL
EXTENSION
EXTENSION_NODE
FAILOVER_MODE
FINI_TIMEOUT
GLOBAL_ZONE_OVERRIDE
GROUP
INIT_TIMEOUT
LOAD_BALANCING_POLICY
LOAD_BALANCING_WEIGHTS
MONITORED_SWITCH
MONITORED_SWITCH_NODE
MONITOR_CHECK_TIMEOUT
MONITOR_START_TIMEOUT
MONITOR_STOP_TIMEOUT
NETWORK_RESOURCES_USED
NUM_RESOURCE_RESTARTS
NUM_RESOURCE_RESTARTS_ZONE
NUM_RG_RESTARTS
NUM_RG_RESTARTS_ZONE
ON_OFF_SWITCH
ON_OFF_SWITCH_NODE
PORT_LIST
POSTNET_STOP_TIMEOUT
PRENET_START_TIMEOUT
RESOURCE_DEPENDENCIES
RESOURCE_DEPENDENCIES_OFFLINE_RESTART
RESOURCE_DEPENDENCIES_RESTART
RESOURCE_DEPENDENCIES_WEAK
RESOURCE_PROJECT_NAME
RESOURCE_STATE
RESOURCE_STATE_NODE
RETRY_COUNT
RETRY_INTERVAL
R_DESCRIPTION
SCALABLE
START_TIMEOUT
STATUS
STATUS_NODE
STOP_TIMEOUT
THOROUGH_PROBE_INTERVAL
TYPE
TYPE_VERSION
UDP_AFFINITY
UPDATE_TIMEOUT
VALIDATE_TIMEOUT
WEAK_AFFINITY
The following optag values are not described in the r_properties(5) man page.

.na ALL_EXTENSIONS .ad Generates, on successive lines, the names of all extension properties of the resource.

.na EXTENSION .ad Generates the type of property followed by its value, on successive lines. If the property is a per-node extension property, the value that is returned is the value of the property on the node on which scha_resource_get is executed. Requires an unflagged argument that names an extension property of the resource. Shell scripts might need to discard the type to obtain the value, as shown in EXAMPLES. When a user requests the value of this property on a node or zone for which an explicit value has not been assigned, the default value that is declared in the Resource Type Registration (RTR) file is returned. See the rt_reg(4) man page.

.na EXTENSION_NODE .ad Generates the type of property followed by its value, on successive lines, for the named node or zone. This value requires two unflagged arguments, in the following order, that name an extension of the resource on a particular node or zone:

Extension property name

Node or zone name Shell scripts might need to discard the type to obtain the value. When a user requests the value of this property on a node or zone for which an explicit value has not been assigned, the default value that is declared in the RTR file is returned. See the rt_reg(4) man page.

.na GROUP .ad Generates the name of the resource group in which the resource is configured.

.na RESOURCE_STATE_NODE .ad Generates the value of the resource's RESOURCE_STATE property for the named node or zone. Requires an unflagged argument that names a node or zone.

.na STATUS_NODE .ad Generates the value of the resource's STATUS property for the named node or zone. Requires an unflagged argument that names a node or zone. The following optag values retrieve the corresponding resource type properties. The value of the named property of the resource's type is generated.

Note - optag values, such as API_VERSION and BOOT, are not case sensitive. You can use any combination of uppercase and lowercase letters when you specify optag values. For descriptions of resource type properties, see rt_properties(5).

API_VERSION
BOOT
FAILOVER
FINI
GLOBAL_ZONE
INIT
INIT_NODES
INSTALLED_NODES
IS_LOGICAL_HOSTNAME
IS_SHARED_ADDRESS
MONITOR_CHECK
MONITOR_START
MONITOR_STOP
PKGLIST
POSTNET_STOP
PRENET_START
PROXY
RT_BASEDIR
RT_DESCRIPTION
RT_SYSTEM
RT_VERSION
SINGLE_INSTANCE
START
STOP
UPDATE
VALIDATE
If this resource's type declares the GLOBAL_ZONE_OVERRIDE resource property, the value that is retrieved by the GLOBAL_ZONE optag is the current value of the GLOBAL_ZONE_OVERRIDE property, rather than the value of the GLOBAL_ZONE property. For more information, see the description of the Global_zone property in the rt_properties(5) man page and the Global_zone_override property in the r_properties(5) man page.

.na -Q .ad Include any specified qualifiers in resource dependency lists. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page. If you omit the -Q option, the returned value of resource dependency lists contain only the resource names, without any declared qualifiers.

.na -R resource .ad The name of a resource that is being managed by the RGM cluster facility.

EXAMPLES

Example 1 Sample Script That Uses the scha_resource_get Command

The following script is passed -R and -G arguments, which provide the required resource name and resource group name. Next, the scha_resource_get command accesses the Retry_count property of the resource and the enum-type LogLevel extension property of the resource.

#!/bin/sh

while getopts R:G: opt
do
 case $opt in
 R) resource="$OPTARG";;
 G) group="$OPTARG";;
 esac
done

retry_count=`scha_resource_get -O Retry_count -R $resource \ 
-G $group`
printf "retry count for resource %s is %d\en" $resource \\
$retry_count

LogLevel_info=`scha_resource_get -O Extension -R $resource \\
-G $group LogLevel`

# Get the enum value that follows the type information
# of the extension property. Note that the preceding
# assignment has already changed the newlines separating
# the type and the value to spaces for parsing by awk.

loglevel=`echo $LogLevel_info | awk '{print $2}'`

Example 2 Using the scha_resource_get Command With and Without the -Q Option to Query Resource Dependencies

This example shows how to use the clresource command to create a resource named myres, with several resource dependencies that have a {LOCAL_NODE} scope qualifier, a {ANY_NODE} scope qualifier, or no scope qualifier. This example then shows how to use the scha_resource_get command to query the Resource_dependencies property. Without the -Q option, only resource names are returned. With the -Q option, the declared scope qualifiers are returned as well.

# clresource create -g mygrp -t myrestype \
-p Resource_dependencies=myres2{LOCAL_NODE},myres3{ANY_NODE},myres4 \
myres
# scha_resource_get -O Resource_dependencies -R myres -G mygrp
myres2
myres3
myres4
# scha_resource_get -Q -O Resource_dependencies -R myres -G mygrp
myres2{LOCAL_NODE}
myres3{ANY_NODE}
myres4
# 
EXIT STATUS

The following exit status codes are returned:

.na 0 .ad The command completed successfully.

.na nonzero .ad An error occurred. Failure error codes are described in scha_calls(3HA).

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
AvailabilitySUNWscdev
Interface StabilityEvolving
SEE ALSO

awk(1), scha_cmds(1HA), scha_calls(3HA), scha_resource_get(3HA), rt_reg(4), attributes(5), property_attributes(5), r_properties(5), rt_properties(5)