 |
Index for Section 3 |
|
 |
Alphabetical listing for C |
|
 |
Bottom of page |
|
clu_info(3)
NAME
clu_info, clu_get_info, clu_free_info, clu_get_memb_by_name,
clu_get_memb_by_id, clu_free_memb - Gets information about a cluster and
its members
LIBRARY
Cluster Library (libclu.so)
SYNOPSIS
#include <sys/clu.h>
clu_info
int clu_info(
int clu_info_type,
...);
int clu_info(
CLU_INFO_MEMBSTATE,
size_t memb_array_size,
char *member_array);
int clu_info(
CLU_INFO_LIMITS,
struct clu_limits *limits);
int clu_info(
CLU_INFO_CLU_NAME,
char *name,
size_t size);
int clu_info(
CLU_INFO_INTERNAME_BY_ID,
memberid_t memberid,
char *intername,
size_t size);
int clu_info(
CLU_INFO_INTERNAME_BY_NAME,
char *hostname,
char *intername,
size_t size);
int clu_info(
CLU_INFO_HOSTNAME_BY_ID,
memberid_t memberid,
char *hostname_out,
size_t size);
int clu_info(
CLU_INFO_NODENAME_BY_ID,
memberid_t memberid,
char *nodename,
size_t size);
int clu_info(
CLU_INFO_NODENAME_BY_NAME,
char *hostname,
char *nodename,
size_t size);
int clu_info(
CLU_INFO_MEMBERID_BY_NAME,
char *hostname,
memberid_t *memberid_out);
int clu_info(
CLU_INFO_MEMBLIST,
char **namelist,
size_t *array_size,
size_t name_length);
int clu_info(
CLU_INFO_MY_ID,
memberid_t *my_memberid);
clu_get_info
int clu_get_info (
struct clu_gen_info **clu_gen_ptr );
clu_free_info
void clu_free_info (
struct clu_gen_info **clu_gen_ptr );
clu_get_memb_by_name
int clu_get_memb_by_name (
char *hostname,
struct clu_member_info **clu_memb_ptr );
clu_get_memb_by_id
int clu_get_memb_by_id (
memberid_t memberid,
struct clu_member_info **clu_memb_ptr );
clu_free_memb
int clu_free_memb (
struct clu_member_info **clu_memb_ptr );
PARAMETERS
clu_info_type
One of the information constants defined in <sys/clu.h>:
CLU_INFO_MEMBSTATE, CLU_INFO_LIMITS, CLU_INFO_CLU_NAME,
CLU_INFO_INTERNAME_BY_ID, CLU_INFO_INTERNAME_BY_NAME,
CLU_INFO_HOSTNAME_BY_ID, CLU_INFO_NODENAME_BY_ID,
CLU_INFO_NODENAME_BY_NAME, CLU_INFO_MEMBERID_BY_NAME,
CLU_INFO_MEMBLIST, CLU_INFO_MY_ID. These constants specify the
type of cluster query being made.
array_size
Number of elements in the namelist array.
hostname String containing the host name used to specify the cluster
member for which to retrieve information.
hostname_out
Pointer to a caller-allocated buffer that holds a string, which
clu_info() fills with the host name of the specified member.
intername Pointer to a caller-allocated buffer that holds a string, which
clu_info() fills with the interconnect name of the specified
member.
limits A caller-allocated structure of type struct clu_limits, which
clu_info() will fill with the minimum supported member ID, the
maximum supported member ID, and the maximum supported number of
members in a cluster.
memb_array_size
Number of elements in the member_array array.
member_array
Pointer to a caller-allocated character array that will hold
information about each member's state. The size of the array
should be CLU_MAX_MEMBERID + 1. The element of the array that
matches the member ID of a member will contain that member's
current state: CLU_MEMB_NOT_CONF (-1), CLU_MEMB_CONF_DOWN (0), or
CLU_MEMB_CONF_UP (1). For example, member_array[2] will contain
the state of member 2.
memberid Member ID of the cluster member for which to retrieve
information.
memberid_out
Pointer to a variable of type memberid_t which will be set to the
member ID of the specified member.
my_memberid
Pointer to a variable of type memberid_t which will be set to the
member ID of the running cluster member.
name Pointer to a caller-allocated buffer that holds a string, which
clu_info will fill with the cluster name.
namelist Pointer to a caller-allocated array that will hold the host names
of all members in the cluster.
name_length
The caller-allocated size of each string element of namelist.
nodename Pointer to a caller-allocated buffer that holds a string, which
clu_info() fills with the Connection Manager (CNX) node name of
the specified member.
size The size of the member array, member_array.
clu_gen_ptr
Address of a pointer to a structure of type struct clu_gen_info,
which clu_get_info() will load with cluster information. (Use
clu_free_info() to free the memory allocated for the structure.)
clu_memb_ptr
Address of a pointer to a structure of type struct
clu_member_info, which clu_get_memb_by_name() and
clu_get_memb_by_id() will load with specific member information.
(Use clu_free_memb() to free the memory allocated for the
structure.)
DESCRIPTION
When called from a member of a cluster, the clu_info() function returns
specific cluster status information when the following options are
specified:
· CLU_INFO_MEMBSTATE - returns the following information about each
cluster member's state: up, down, or not configured.
· CLU_INFO_LIMITS - returns the following information on member IDs and
supported members:
--
Minimum supported member ID
--
Maximum supported member ID
--
Maximum supported number of members in a cluster
· CLU_INFO_CLU_NAME - returns the cluster name.
· CLU_INFO_INTERNAME_BY_ID - returns the cluster interconnect name given
a specific member ID.
· CLU_INFO_INTERNAME_BY_NAME - returns the cluster interconnect name
given a specific member name.
· CLU_INFO_MEMBERID_BY_NAME - returns the member ID given a specific
host name.
· CLU_INFO_HOSTNAME_BY_ID - returns the member host name given a
specific member ID.
· CLU_INFO_NODENAME_BY_ID - returns the Connection Manager (CNX) node
name given a specific member ID.
· CLU_INFO_NODENAME_BY_NAME - returns the CNX node name given a specific
host name.
· CLU_INFO_MEMBLIST - returns a list of host names for all members in
the cluster.
· CLU_INFO_MY_ID - returns the member ID for the member on which it is
run.
When called from a member of a cluster, the clu_get_info() function returns
a structure containing general information about the cluster and its
members. The information includes:
· The name of the cluster and the number of members configured in the
cluster.
· The device name and number of votes of the quorum disk, if configured.
· For each member, its member ID, host name, cluster interconnect IP
name, and current state (UP or DOWN).
When called from a system that is not a cluster member, the clu_get_info()
function returns -1 (CLU_NOT_CONFIGURED).
If a member of the cluster is down, or a member's /etc/rc.config file
contains illegal values, the values returned by string pointers can be
NULL.
Note that the clu_get_info function does not require allocated structures.
While the clu_info function accepts pointers to caller-allocated
structures, the clu_get_info function accepts a pointer to a structure.
The clu_free_info() function frees the memory allocated for a clu_gen_info
structure. The clu_gen_info structure is defined in <sys/clu.h>.
Use the clu_get_memb_by_name() and clu_get_memb_by_id() functions to return
information about a cluster member. The clu_get_memb_by_name() function
returns a structure containing the host name of a cluster member, while the
clu_get_memb_by_id() function returns a structure containing the member ID
of a cluster member.
The clu_free_memb() function frees the memory allocated for a
clu_member_info structure. The clu_member_info structure is defined in
<sys/clu.h>.
EXAMPLES
The following code fragments show typical calling sequences for the
clu_info() options:
CLU_INFO_MEMBSTATE:
size_t size = 256;
char marray[256];
clu_info(CLU_INFO_MEMBSTATE, size, marray);
CLU_INFO_LIMITS:
struct clu_limits limits;
clu_info(CLU_INFO_LIMITS, &limits);
CLU_INFO_CLU_NAME:
char name[MAXHOSTNAMELEN];
clu_info(CLU_INFO_CLU_NAME, name, sizeof(name));
CLU_INFO_INTERNAME_BY_ID:
memberid_t memberid = 2;
char intername[MAXHOSTNAMELEN];
clu_info(CLU_INFO_INTERNAME_BY_ID, memberid, intername, sizeof(intername));
CLU_INFO_INTERNAME_BY_NAME:
char *hostname = "my_member";
char intername[MAXHOSTNAMELEN];
clu_info(CLU_INFO_INTERNAME_BY_NAME, hostname, intername, sizeof(intername));
CLU_INFO_MEMBERID_BY_NAME:
char *hostname = "my_member";
memberid_t memberid_out;
clu_info(CLU_INFO_MEMBERID_BY_NAME, hostname, &memberid_out);
CLU_INFO_HOSTNAME_BY_ID:
memberid_t memberid = 2;
char hostname_out[MAXHOSTNAMELEN];
clu_info(CLU_INFO_HOSTNAME_BY_ID, memberid, hostname_out, sizeof(hostname_out));
CLU_INFO_NODENAME_BY_ID:
memberid_t memberid = 2;
char nodename[MAXHOSTNAMELEN];
clu_info(CLU_INFO_NODENAME_BY_ID, memberid, nodename, sizeof(nodename));
CLU_INFO_NODENAME_BY_NAME:
char *hostname = "my_member";
char nodename[MAXHOSTNAMELEN];
clu_info(CLU_INFO_NODENAME_BY_NAME, hostname, nodename, sizeof(nodename));
CLU_INFO_MEMBLIST:
struct clu_limits limits;
char **namelist;
size_t size;
int i;
clu_info(CLU_INFO_LIMITS, &limits);
size = limits.max_membid;
namelist = (char **)calloc(size,sizeof(char *));
for(i=0;i<size;i++) {
namelist[i] = (char *)calloc(MAXHOSTNAMELEN,sizeof(char));
namelist[i][0] = ' ';
}
clu_info(CLU_INFO_MEMBLIST, namelist, &size, MAXHOSTNAMELEN);
CLU_INFO_MY_ID:
memberid_t my_memberid;
clu_info(CLU_INFO_MY_ID, &my_memberid);
The following code fragment shows a typical calling sequence for the
clu_get_info() function:
#include <sys/clu.h>
int retval = 0;
int i = 0;
struct clu_gen_info *clugenptr;
clugenptr = NULL;
retval = clu_get_info(&clugenptr);
switch (retval) {
case 0: break;
case CLU_NOT_MEMBER:
case CLU_NO_CLUSTER_NAME:
case CLU_NO_MEMBERID:
case CLU_CNX_ERROR:
fprintf(stderr, "clu_get_info() error0);
exit(1);
default:
exit(1);
}
if (clugenptr == NULL)
exit(1);
for (i = 0; i <= clugenptr->clu_num_of_members -1; i++) {
/* print or use the returned info; for example: */
printf("member hostname is %s0, clugenptr->memblist[i].hostname);
}
clu_free_info(&clugenptr);
The following code fragment shows a typical calling sequence for the
clu_get_memb_by_id() function (clu_get_memb_by_name() is similar):
#include <sys/clu.h>
#include <errno.h>
memberid_t memberid = 2;
struct clu_member_info *membinfo = NULL;
if (clu_get_memb_by_id(2, &membinfo)) {
fprintf(stderr, "Error! Return code of %d0, errno);
exit(1);
}
printf("Member cluster version is %s0, membinfo->clu_version);
clu_free_memb(&membinfo);
RETURN VALUES
The clu_get_info() and clu_free_info() functions return one of the
following values:
0 Successful completion.
CLU_NOT_CONFIGURED (-1)
System is not configured to be in a cluster.
CLU_NOT_MEMBER Called from a system that is not a cluster member.
CLU_NO_MEMORY There is no memory for the interface.
CLU_NO_MEMBERID
Cannot determine the value of the sysconfigtab memberid
attribute.
CLU_CNX_ERROR Cannot query Connection Manager (CNX) subsystem.
EINVAL The input to member_array is not large enough.
The clu_info(), clu_get_memb_by_name(), clu_get_memb_by_id(), and
clu_free_memb() functions return one of the following values:
0 Successful completion.
-1 The operation was unsuccessful. Check errno to determine the
error.
FILES
/etc/rc.config Run-time configuration file for each cluster member.
RELATED INFORMATION
Commands: clu_get_info(8)
Files: rc.config(8)
 |
Index for Section 3 |
|
 |
Alphabetical listing for C |
|
 |
Top of page |
|