Sun Microsystems, Inc.
   www.sun.com docs.sun.com | | |  
   
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
    
 
Sun Cluster HA and Data Servicesscha_resourcegroup_open(3HA)


NAME

 scha_resourcegroup_open, scha_resourcegroup_close, scha_resourcegroup_get - 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_resourcegroup_open(const char *rgname, scha_resourcegroup_t *handle);
 scha_err_t scha_resourcegroup_close(scha_resourcegroup_t *handle);
 scha_err_t scha_resourcegroup_get(scha_resourcegroup_t *handle, const char *tag...);

DESCRIPTION

 

The scha_resourcegroup_open(), scha_resourcegroup_get() and scha_resourcegroup_close() functions are used together to access information on a resource group that is managed by the Resource Group Manager (RGM) cluster facility.

scha_resourcegroup_open() initializes access of the resource group and returns a handle to be used by scha_resourcegroup_get().

The rgname argument names the resource group to be accessed.

The handle argument is the address of a variable to hold the value returned from the function call.

scha_resourcegroup_get() accesses resource group information as indicated by the tag argument. The tag 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 may be needed to indicate a cluster node from which the information is to be retrieved.

The last argument in the argument list is to be of a type suitable to hold the information indicated by tag. This is the out argument for the resource group information that is to be retrieved. No value is returned for the out parameter if the function fails. Memory that is allocated to hold information returned by scha_resourcegroup_get() remains intact until scha_resourcegroup_close() is called on the handle used for scha_resourcegroup_get().

scha_resourcegroup_close() takes a handle argument returned from a previous call to scha_resourcegroup_open(). It invalidates the handle and frees memory allocated to return values to scha_resourcegroup_get() calls that were made with the handle. Note that memory, if needed to return a value, is allocated for each get call. Space allocated to return a value in one call will not be overwritten and reused by subsequent calls.

Macros defined in <scha_tags.h> that may be used as tag arguments to scha_resourcegroup_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 naming resource group properties are listed below. The value of the property of the resource group is output. The RG_STATE property refers to the value on the node where the function is called.

SCHA_DESIRED_PRIMARIES
The output argument type is int*.
SCHA_FAILBACK
The output argument type is boolean_t*.
SCHA_GLOBAL_RESOURCES_USED
The output argument type is scha_str_array_t**.
SCHA_IMPL_NET_DEPEND
The output argument type is boolean_t*.
SCHA_MAXIMUM_PRIMARIES
The output argument type is int*.
SCHA_NODELIST
The output argument type is scha_str_array_t**.
SCHA_PATHPREFIX
The output argument type is char**.
SCHA_PINGPONG_INTERVAL
The output argument type is int*.
SCHA_RESOURCE_LIST
The output argument type is scha_str_array_t**.
SCHA_RG_AUTO_START
The output argument type is boolean_t*.
SCHA_RG_DEPENDENCIES
The output argument type is scha_str_array_t**.
SCHA_RG_DESCRIPTION
The output argument type is char**.
SCHA_RG_IS_FROZEN
The output argument type is boolean_t*.
SCHA_RG_MODE
The output argument type is rgm_rgmode_t*.
SCHA_RG_PROJECT_NAME
The output argument type is char**.
SCHA_RG_STATE
The output argument type is scha_rgstate_t*.
SCHA_RG_STATE_NODE
The output argument type is scha_rgstate_t*. An additional argument type is char*. The additional argument names a cluster node. It returns the state of the resource group on that node.

SCHA_RG_SYSTEM
The output argument type is boolean_t*.

RETURN VALUES

 

These functions return the following:

0
The function succeeded.
non-zero
The function failed.

ERRORS

 
SCHA_ERR_NOERR
Function succeeded.

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


EXAMPLES

 Example 1. Using the scha_resourcegroup_get() Function
 

The following example uses scha_resourcegroup_get() to get the list of resources in the resource group example_RG.

 
main() {

   #include <scha.h>

   scha_err_t err;
   scha_str_array_t *resource_list;
   scha_resourcegroup_t handle;
   int ix;

   char * rgname = "example_RG";	

   err = scha_resourcegroup_open(rgname, &handle);

   err = scha_resourcegroup_get(handle, SCHA_RESOURCE_LIST, &resource_list);

   if (err == SCHA_ERR_NOERR) {
    for (ix = 0; ix < resource_list->array_cnt; ix++) {
        printf("Group: %s contains resource %s\n", rgname,
                resource_list->str_array[ix]);
        }
    }

 err = scha_resourcegroup_close(handle);	/* resource_list memory freed */
}

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 TYPEATTRIBUTE VALUE
AvailabilitySUNWscdev
Interface StabilityEvolving

SEE ALSO

 

scha_resourcegroup_get(1HA) , scha_calls(3HA), attributes(5)



Sun Cluster 3.1Go To TopLast Changed 02 May 2003

 
      
      
Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.