cl_getnodemap routine
The cl_getnodemap routine returns information about the nodes in a cluster. You should call cl_alloc_nodemap before calling this routine to reserve the storage in memory. You should call cl_free_nodemap after calling this routine.
Syntax
int cl_getnodemap (int clusterid, struct cl_node *nodemap)Parameters
| Item | Description |
|---|---|
| clusterid | The cluster ID of the desired cluster. |
| nodemap | Storage for the returned node information. |
Status codes
The request completed successfully if it returns a non-negative number (number of nodes in the cluster).
| Item | Description |
|---|---|
| CLE_SYSERR | System error. Check the AIX® global variable errno for additional information. |
| CLE_BADARGS | Missing or invalid parameters. |
| CLE_IVCLUSTERID | The request specified an invalid cluster ID. |
Example
int clusterid = 1113325332;
int i;
int nodes;
struct cl_node *nodemap;
cl_alloc_nodemap (&nodemap);
if (nodemap==NULL){
printf("unable to allocate storage: cl_alloc_nodemap = NULL\n");
exit(-1);
}
nodes = cl_getnodemap(clusterid, nodemap);
if(nodes < 0)
{
cl_perror(nodes,"can't get node map");
} else {
printf("cluster %d has %d nodes:\n", clusterid, nodes);
for(i=0; i < nodes; i++){
printf("node %s in state %d has %d interfaces\n",
nodemap[i].cln_nodename,
nodemap[i].cln_state,
nodemap[i].cln_nif);
if(clusterid != nodemap[i].cln_clusterid){
printf("structure has invalid cluster ID: %d",
nodemap[i].cln_clusterid);
}
}
}
cl_free_nodemap(nodemap);