Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

scha_cluster_getzone(3ha) [opensolaris man page]

scha_cluster_getzone(3HA)				 Sun Cluster HA and Data Services				 scha_cluster_getzone(3HA)

NAME
scha_cluster_getzone - zone name access function SYNOPSIS
cc [flags...] -I /usr/cluster/include file -L /usr/cluster/lib -l scha #include <scha.h> scha_err_t scha_cluster_getzone(char **zonename); DESCRIPTION
The scha_cluster_getzone() function returns a string that identifies the zone from which the function is called. If you call this function in a non-global zone, the zone name and the node name are returned, in the format nodename:zonename. If you call this function in the global zone, only the node name is returned. The node name is not necessarily the same as the Solaris system name. The function returns an error status. If successful, the function also returns a string that contains the node name and the zone name in the location that is pointed to by the zonename argument. If the call fails, the zonename argument is set to NULL. The caller of scha_cluster_getzone() is responsible for freeing the memory that is allocated for the returned string by using the standard C library function free(3C). Freeing the memory is required only if the function succeeds. RETURN VALUES
The scha_cluster_getzone() function returns 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_cluster_getzone() Function scha_err_t err_code; char *zonename; err_code = scha_cluster_getzone(&zonename); ... if (zonename != NULL) free(zonename); 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 |SUNWscdev | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
free(3C), scha_calls(3HA), scha_cluster_get(3HA), scha_cluster_getnodename(3HA), scha_strerror(3HA), attributes(5) Sun Cluster 3.2 7 Sep 2007 scha_cluster_getzone(3HA)

Check Out this Related Man Page

scha_cluster_open(3HA)					 Sun Cluster HA and Data Services				    scha_cluster_open(3HA)

NAME
scha_cluster_open, scha_cluster_close, scha_cluster_get - cluster information access functions SYNOPSIS
cc [flags...] -I /usr/cluster/include file -L /usr/cluster/lib -l scha #include <scha.h> scha_err_t scha_cluster_open(scha_cluster_t *handle); scha_err_t scha_cluster_get(scha_cluster_t handle, const char **tag, ...); scha_err_t scha_cluster_close(scha_cluster_t handle); DESCRIPTION
The scha_cluster_open(), scha_cluster_get(), and scha_cluster_close() functions are used together to obtain information about a cluster. scha_cluster_open() initializes cluster access and returns an access handle to be used by scha_cluster_get(). The handle argument is the address of a variable to hold the value that is returned by the function call. scha_cluster_get() accesses cluster information as indicated by the tag argument. If you call this function in a non-global zone, the zone name and the node name are returned. The handle argument is a value that is returned from a prior call to scha_cluster_open(). The tag argument is a string value that is defined by a macro in the <scha_tags.h> header file. The arguments that follow the tag depend on the value of the tag argument. You might need to provide an additional argument after the tag argument to indicate a cluster node or zone from which the information is to be retrieved. The last argument in the argument list is to be of a type that is suitable to hold the information that is indicated by the tag argument. This argument is the output argument for the cluster information. No value is returned for the output argument if the func- tion fails. Memory that is allocated to hold information that is returned by the scha_cluster_get() function remains intact until scha_cluster_close() is called on the handle that is used for the scha_cluster_get() function. scha_cluster_close() takes a handle argument that is returned from a previous call to the scha_cluster_get() function. This function inval- idates the handle and frees memory that is allocated to return values to scha_cluster_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 is not overwritten and reused by subsequent calls. Macros That You Can Use for tag Arguments Macros that are defined in <scha_tags.h> that you can use as tag arguments follow. The type of the output argument and any additional arguments are indicated. Structure and enum types are described in scha_calls(3HA). SCHA_ALL_NODEIDS The output argument type is scha_uint_array_t**. This macro returns numeric node identifiers of all the nodes in the cluster. SCHA_ALL_NODENAMES The output argument type is scha_str_array_t**. This macro returns the names of all nodes in the cluster. SCHA_ALL_NONGLOBAL_ZONES The output argument type is scha_str_array_t**. This macro returns zone names of all the non-global zones on all nodes in the cluster. The format of the zone name that is returned is nodename:zonename. SCHA_ALL_NONGLOBAL_ZONES_NODEID The output argument type is scha_str_array_t**. This macro returns zone names of all the non-global zones on the cluster node whose numeric node identifier is given as the argument. The format of the zone name that is returned is nodename:zonename. SCHA_ALL_PRIVATELINK_HOSTNAMES The output argument type is scha_str_array_t**. This macro returns the host names for all cluster nodes or zones by which the nodes or zones are addressed on the cluster interconnect. SCHA_ALL_RESOURCEGROUPS The output argument type is scha_str_array_t**. This macro returns the names of all the resource groups that are being managed on the cluster. SCHA_ALL_RESOURCETYPES The output argument type is scha_str_array_t**. This macro returns the names of all the resource types that are registered on the cluster. SCHA_ALL_ZONES The output argument type is scha_str_array_t**. This macro returns zone names of all zones, including the global zone, on all nodes in the cluster. The format of the zone name that is returned is nodename:zonename. SCHA_ALL_ZONES_NODEID The output argument type is scha_str_array_t**. This macro returns zone names of all zones, including the global zone, on the cluster node whose numeric node identifier is given as the argument. The format of the zone name that is returned is nodename:zonename. SCHA_CLUSTERNAME The output argument is type char**. This macro returns the name of the cluster. SCHA_NODEID_LOCAL The output argument type is uint_t*. This macro returns the numeric node identifier for the node where the command is executed. SCHA_NODEID_NODENAME The output argument type is uint_t*. An additional argument is of type char *. The macro requires an additional argument that is a name of a cluster node. This macro returns the numeric node identifier of the node indicated by the name. SCHA_NODENAME_LOCAL The output argument type is char**. This macro returns the name of the cluster node where the function is executed. SCHA_NODENAME_NODEID The output argument type is char**. An additional argument is of type uint_t. The additional argument is a numeric cluster node identi- fier. This macro returns the name of the node indicated by the numeric identifier. SCHA_NODESTATE_LOCAL The output argument type is scha_node_state_t*. This macro returns SCHA_NODE_UP or SCHA_NODE_DOWN, depending on the state of the node where the command is executed. SCHA_NODESTATE_NODE The output argument type is scha_node_state_t*. An additional argument is type char*. The macro requires an additional unflagged argu- ment that is the name of a cluster node. This macro returns SCHA_NODE_UP or SCHA_NODE_DOWN, depending on the state of the named node. SCHA_PRIVATELINK_HOSTNAME_LOCAL The output argument type is char**. This macro returns the host name by which the node or zone on which the command is run is addressed on the cluster interconnect. SCHA_PRIVATELINK_HOSTNAME_NODE The output argument type is char**. An additional argument is of type char *. This macro requires an additional unflagged argument that is the name of a cluster node. This macro returns the host name by which the named node or zone is addressed on the cluster interconnect. SCHA_SYSLOG_FACILITY The output argument type is int*. This macro returns the number of the syslog(3C) facility that the RGM uses for log messages. The value that is returned is 24, which corresponds to the LOG_DAEMON facility value. SCHA_ZONE_LOCAL The output argument type is scha_str_array_t**. This macro returns the name of the zone from which the call is made. The format of the zone name that is returned is nodename:zone- name. ERRORS
SCHA_ERR_NOERR The function succeeded. See scha_calls(3HA) for a description of other error codes. EXAMPLES
Example 1 Using the scha_cluster_get() Function The following example uses the scha_cluster_get() function to get the names of all cluster nodes. The function also determines whether the node is up or down. #include <scha.h> #include <stdio.h> #include <stdlib.h> main() { scha_err_t err; scha_node_state_t node_state; scha_str_array_t *all_nodenames; scha_cluster_t handle; int ix; const char *str; err = scha_cluster_open(&handle); if (err != SCHA_ERR_NOERR) { fprintf(stderr, "FAILED: scha_cluster_open()0); exit(err); } err = scha_cluster_get(handle, SCHA_ALL_NODENAMES, &all_nodenames); if (err != SCHA_ERR_NOERR) { fprintf(stderr, "FAILED: scha_cluster_get()0); exit(err); } for (ix = 0; ix < all_nodenames->array_cnt; ix++) { err = scha_cluster_get(handle, SCHA_NODESTATE_NODE, all_nodenames->str_array[ix], &node_state); if (err != SCHA_ERR_NOERR) { fprintf(stderr, "FAILED: scha_cluster_get()" "SCHA_NODESTATE_NODE0); exit(err); } switch (node_state) { case SCHA_NODE_UP: str = "UP"; break; case SCHA_NODE_DOWN: str = "DOWN"; break; } printf("State of node: %s value: %s0, all_nodenames->str_array[ix], str); } } 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 |SUNWscdev | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
scha_cluster_get(1HA), scha_calls(3HA), scha_cluster_getlogfacility(3HA), scha_cluster_getnodename(3HA), scha_strerror(3HA), syslog(3C), attributes(5) Sun Cluster 3.2 7 Sep 2007 scha_cluster_open(3HA)
Man Page