JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Cluster Reference Manual     Oracle Solaris Cluster 4.0
search filter icon
search icon

Document Information

Preface

Introduction

OSC40 1

OSC40 1cl

OSC40 1ha

OSC40 1m

OSC40 3ha

scds_calls(3HA)

scds_close(3HA)

scds_error_string(3HA)

scds_error_string_i18n(3HA)

scds_failover_rg(3HA)

scds_fm_action(3HA)

scds_fm_net_connect(3HA)

scds_fm_net_disconnect(3HA)

scds_fm_print_probes(3HA)

scds_fm_sleep(3HA)

scds_fm_tcp_connect(3HA)

scds_fm_tcp_disconnect(3HA)

scds_fm_tcp_read(3HA)

scds_fm_tcp_write(3HA)

scds_free_ext_property(3HA)

scds_free_netaddr_list(3HA)

scds_free_net_list(3HA)

scds_free_port_list(3HA)

scds_get_current_method_name(3HA)

scds_get_ext_property(3HA)

scds_get_netaddr_list(3HA)

scds_get_port_list(3HA)

scds_get_resource_group_name(3HA)

scds_get_resource_name(3HA)

scds_get_resource_type_name(3HA)

scds_get_rg_hostnames(3HA)

scds_get_rs_hostnames(3HA)

scds_get_zone_name(3HA)

scds_hasp_check(3HA)

scds_initialize(3HA)

scds_pmf_get_status(3HA)

scds_pmf_restart_fm(3HA)

scds_pmf_signal(3HA)

scds_pmf_start(3HA)

scds_pmf_start_env(3HA)

scds_pmf_stop(3HA)

scds_pmf_stop_monitoring(3HA)

scds_print_netaddr_list(3HA)

scds_print_net_list(3HA)

scds_print_port_list(3HA)

scds_property_functions(3HA)

scds_restart_resource(3HA)

scds_restart_rg(3HA)

scds_simple_net_probe(3HA)

scds_simple_probe(3HA)

scds_svc_wait(3HA)

scds_syslog(3HA)

scds_syslog_debug(3HA)

scds_timerun(3HA)

scha_calls(3HA)

scha_cluster_close(3HA)

scha_cluster_get(3HA)

scha_cluster_getlogfacility(3HA)

scha_cluster_getnodename(3HA)

scha_cluster_getzone(3HA)

scha_cluster_open(3HA)

scha_control(3HA)

scha_resource_close(3HA)

scha_resource_get(3HA)

scha_resourcegroup_close(3HA)

scha_resourcegroup_get(3HA)

scha_resourcegroup_open(3HA)

scha_resource_open(3HA)

scha_resource_setstatus(3HA)

scha_resourcetype_close(3HA)

scha_resourcetype_get(3HA)

scha_resourcetype_open(3HA)

scha_strerror(3HA)

scha_strerror_i18n(3HA)

OSC40 4

OSC40 5

OSC40 5cl

OSC40 7

OSC40 7p

Index

scha_resource_open

, scha_resource_get

, scha_resource_close

- resource information access functions

Synopsis

cc [flags…] -I /usr/cluster/include file -L /usr/cluster/lib -l scha
#include <scha.h>

scha_err_t scha_resource_open(const char *rname, const char *rgname,
     scha_resource_t *handle);
scha_err_t scha_resource_get(scha_resource_t handle, const char *tag,...);
scha_err_t scha_resource_close(scha_resource_t handle);

Description

The scha_resource_open(), scha_resource_get(), and scha_resource_close() functions are used together to access information about a resource that is managed by the Resource Group Manager (RGM) cluster facility.

scha_resource_open() initializes access of the resource and returns a handle to be used by scha_resource_get().

The rname argument of scha_resource_open() names the resource to be accessed. The rgname argument is the name of the resource group in which the resource is configured. The rgname argument may be NULL if the group name is not known. However, the execution of the function is more efficient if it is provided. The handle argument is the address of a variable to hold the value returned from the function call.

scha_resource_get() accesses resource information as indicated by the tag argument. The tag argument should be a string value defined by a macro in the scha_tags.h header file. Arguments following the tag depend on the value of tag. An additional argument following the tag might be needed to indicate a cluster node from which the information is to be retrieved, or other information that is specific to the tag. The last argument in the argument list is to be of a type that is suitable to hold the information that is indicated by tag. This argument is the output argument for the resource information. No value is returned for the output argument if the function fails.

Memory that is allocated to hold information returned by scha_resource_get() remains intact until scha_resource_close() is called on the handle used for the scha_resource_get(). Note that repeated calls to scha_resource_get() with the same handle and tag cause new memory to be allocated. Space allocated to return a value in one call will not be overwritten and reused by subsequent calls.

scha_resource_close() takes a handle argument that is returned from a previous call to scha_resource_open(). It invalidates the handle and frees memory allocated to return values to scha_resource_get() calls that were made with the handle.

Macros defined in scha_tags.h that might be used as tag arguments to scha_resource_get() follow.

The type of the output argument and any additional arguments are indicated. Structure and enum types are described in scha_calls(3HA).

Tag Arguments

Macros that name resource properties are listed below. The value of the property of the resource is output. The SCHA_RESOURCE_STATE, SCHA_STATUS, SCHA_NUM_RG_RESTARTS, and SCHA_NUM_RESOURCE_RESTARTS properties refer to the value on the node where the command is executed (see r_properties(5)).

Extension properties

These properties are declared in the Resource Type Registration (RTR) file of the resource's type. The implementation of the resource type defines these properties.

SCHA_AFFINITY_TIMEOUT

The output argument type is int*.

SCHA_ALL_EXTENSIONS

The output argument type is scha_str_array_t*.

SCHA_BOOT_TIMEOUT

The output argument type is int*.

SCHA_CHEAP_PROBE_INTERVAL

The output argument type is int*.

SCHA_EXTENSION

The output argument type is scha_extprop_value_t*.

When a user requests the value of this property on a node 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.

SCHA_EXTENSION_NODE

The output argument type is scha_extprop_value_t*.

When a user requests the value of this property on a node 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.

SCHA_FAILOVER_MODE

The output argument type is scha_failover_mode_t*.

SCHA_FINI_TIMEOUT

The output argument type is int*.

SCHA_GLOBAL_ZONE_OVERRIDE

The output argument type is boolean_t*.

SCHA_GROUP

The output argument type is char**.

SCHA_INIT_TIMEOUT

The output argument type is int*.

SCHA_LOAD_BALANCING_POLICY

The output argument type is char**.

SCHA_LOAD_BALANCING_WEIGHTS

The output argument type is scha_str_array_t**.

SCHA_MONITOR_CHECK_TIMEOUT

The output argument type is int*.

SCHA_MONITOR_START_TIMEOUT

The output argument type is int*.

SCHA_MONITOR_STOP_TIMEOUT

The output argument type is int*.

SCHA_MONITORED_SWITCH

The output argument type is scha_switch_t*.

SCHA_MONITORED_SWITCH_NODE

The output argument type is scha_switch_t*.

SCHA_NETWORK_RESOURCES_USED

The output argument type is scha_str_array_t**.

SCHA_NUM_RESOURCE_RESTARTS

The output argument type is int*.

SCHA_NUM_RG_RESTARTS

The output argument type is int*.

SCHA_ON_OFF_SWITCH

The output argument type is scha_switch_t*.

SCHA_ON_OFF_SWITCH_NODE

The output argument type is scha_switch_t*.

SCHA_PORT_LIST

The output argument type is scha_str_array_t**.

SCHA_POSTNET_STOP_TIMEOUT

The output argument type is int*.

SCHA_PRENET_START_TIMEOUT

The output argument type is int*.

SCHA_R_DESCRIPTION

The output argument type is char**.

SCHA_RESOURCE_DEPENDENCIES

The output argument type is scha_str_array_t**.

SCHA_RESOURCE_DEPENDENCIES_Q

The output argument type is scha_str_array_t**.

The “Q” version of the SCHA_RESOURCE_DEPENDENCIES tag also returns the scope, or qualifier, if any, that was declared for the resource dependency. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page.

SCHA_RESOURCE_DEPENDENCIES_OFFLINE_RESTART

The output argument type is scha_str_array_t**.

SCHA_RESOURCE_DEPENDENCIES_Q_OFFLINE_RESTART

The output argument type is scha_str_array_t**.

The “Q” version of the SCHA_RESOURCE_DEPENDENCIES_OFFLINE_RESTART tag also returns the scope, or qualifier, if any, that was declared for the resource dependency. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page.

SCHA_RESOURCE_DEPENDENCIES_RESTART

The output argument type is scha_str_array_t**.

SCHA_RESOURCE_DEPENDENCIES_Q_RESTART

The output argument type is scha_str_array_t**.

The “Q” version of the SCHA_RESOURCE_DEPENDENCIES_RESTART tag also returns the scope, or qualifier, if any, that was declared for the resource dependency. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page.

SCHA_RESOURCE_DEPENDENCIES_WEAK

The output argument type is scha_str_array_t**.

SCHA_RESOURCE_DEPENDENCIES_Q_WEAK

The output argument type is scha_str_array_t**.

The “Q” version of the SCHA_RESOURCE_DEPENDENCIES_WEAK tag also returns the scope, or qualifier, if any, that was declared for the resource dependency. The {LOCAL_NODE}, {ANY_NODE}, and {FROM_RG_AFFINITIES} qualifiers are described in the r_properties(5) man page.

SCHA_RESOURCE_PROJECT_NAME

The output argument type is char**.

SCHA_RESOURCE_STATE

The output argument type is scha_rsstate_t*.

SCHA_RESOURCE_STATE_NODE

The output argument type is scha_rsstate_t*.

SCHA_RETRY_COUNT

The output argument type is int*.

SCHA_RETRY_INTERVAL

The output argument type is int*.

SCHA_SCALABLE

The output argument type is boolean_t*.

SCHA_START_TIMEOUT

The output argument type is int*.

SCHA_STATUS

The output argument type is scha_status_value_t**.

SCHA_STATUS_NODE

The output argument type is scha_status_value_t**.

SCHA_STOP_TIMEOUT

The output argument type is int*.

SCHA_THOROUGH_PROBE_INTERVAL

The output argument type is int*.

SCHA_TYPE

The output argument type is char**.

SCHA_TYPE_VERSION

The output argument type is char**.

SCHA_UDP_AFFINITY

The output argument type is boolean_t*.

SCHA_UPDATE_TIMEOUT

The output argument type is int*.

SCHA_VALIDATE_TIMEOUT

The output argument type is int*.

SCHA_WEAK_AFFINITY

The output argument type is boolean_t*.

Macros that name resource type properties are listed below. The value of the property of the resource's type is output. For descriptions of resource type properties, see rt_properties(5).

SCHA_API_VERSION

The output argument type is int*.

SCHA_BOOT

The output argument type is char**.

SCHA_FAILOVER

The output argument type is boolean_t*.

SCHA_FINI

The output argument type is char**.

SCHA_GLOBAL_ZONE

The output argument type is boolean_t*.

SCHA_INIT

The output argument type is char**.

SCHA_INIT_NODES

The output argument type is scha_initnodes_flag_t*.

SCHA_INSTALLED_NODES

The output argument type is scha_str_array_t**.

SCHA_MONITOR_CHECK

The output argument type is char**.

SCHA_MONITOR_START

The output argument type is char**.

SCHA_MONITOR_STOP

The output argument type is char**.

SCHA_PKGLIST

The output argument type is scha_str_array_t**.

SCHA_POSTNET_STOP

The output argument type is char**.

SCHA_PRENET_START

The output argument type is char**.

SCHA_PROXY

The output argument type is boolean_t*.

SCHA_RT_BASEDIR

The output argument type is char**.

SCHA_RT_DESCRIPTION

The output argument type is char**.

SCHA_RT_SYSTEM

The output argument type is boolean_t*.

SCHA_RT_VERSION

The output argument type is char**.

SCHA_SINGLE_INSTANCE

The output argument type is boolean_t*.

SCHA_START

The output argument type is char**.

SCHA_STOP

The output argument type is char**.

SCHA_UPDATE

The output argument type is char**.

SCHA_VALIDATE

The output argument type is char**.

If this resource's type declares the GLOBAL_ZONE_OVERRIDE resource property, the value that is retrieved by the SCHA_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.

Return Values

These functions return the following values:

0

The function succeeded.

nonzero

The function failed.

Errors

SCHA_ERR_NOERR

The function succeeded.

See scha_calls(3HA) for a description of other error codes.

Examples

Example 1 Using the scha_resource_get() Function

The following example uses scha_resource_get() to get the value of the Retry_count property of a resource, and the value of the extension property named Loglevel.

main() {
  #include <scha.h>

  scha_err_t err;
  int *retry_count_out;
  scha_extprop_value_t *loglevel_out;
  scha_resource_t handle;

/* a configured resource */
  char * resource_name = "example_R";    
/* resource group containing example_R */
  char * group_name = "example_RG";

  err = scha_resource_open(resource_name, group_name, &handle);

  err = scha_resource_get(handle, SCHA_RETRY_COUNT, &retry_count_out);

/* Given extension property must be defined in resourcetype RTR file. */
  err = scha_resource_get(handle, SCHA_EXTENSION, "LogLevel", &loglevel_out);

  err = scha_resource_close(handle);

  printf("The retry count for resource %s is %d\n", resource_name,
         retry_count_out);

  printf("The log level for resource %s is %d\n", resource_name,
         loglevel_out->val.val_int);
}

Files

/usr/cluster/include/scha.h

Include file

/usr/cluster/lib/libscha.so

Library

Attributes

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

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
ha-cluster/developer/api
Interface Stability
Evolving

See Also

scha_resource_get(1HA), scha_calls(3HA), scha_strerror(3HA), attributes(5), r_properties(5), rt_properties(5), rt_reg(4)