C H A P T E R 4 |
This chapter describes how to use the functions of the CLM API to retrieve information about nodes. For more information, see the following topics:
The functions saClmClusterNodeGet() and saClmClusterNodeGetAsync() retrieve information about the node specified. The node is specified by providing its node id. The special node id, SA_CLM_LOCAL_NODE_ID, can be used to specify the local node without knowing the local node’s node id. When run successfully, the functions return a SaClmClusterNodeT structure that contains information about the requested node. For information about this structure, refer to Using the saClmClusterNodeT Structure for Information About Cluster Nodes.For an example, refer to EXAMPLE 3-3.The asynchronous version of the function returns immediately, but the request will be processed asynchronously by the nhcmmd daemon. When the results are ready, the callback specified during the initialization of the library will be executed.For the callback to be called, you must obtain a selection object, which you can do using the saClmSelectionObjectGet() function, you must use the selection object to know when a callback is pending, and you must call the saClmDispatch() function so callbacks are executed, as explained in Library Life Cycle.The following example shows the usage of the saClmClusterNodeGetAsync() function:
Note - For more information about the functions referenced in this section, refer to the corresponding man pages associated with these functions. |
When called with the flag SA_TRACK_CURRENT, the function saClmClusterTrack() will retrieve information about all the cluster nodes. If the parameter notificationBuffer is a NULL pointer, the function will run asynchronously and the results will be provided to the Track callback function. If the pointer is not NULL, then the function will behave synchronously and the results will be stored in the provided buffer. In this latter case, if the notification field of the provided structure is a NULL pointer, then enough memory will be allocated to store the information. The user is responsible for freeing this memory.In the following example, the synchronous version of the call is used and the memory is allocated by the library.
The function print_notif_buffer() is not part of the SA Forum/CLM API and can be found in the common.c file. The following example shows the use of the print_notif_buffer() function, which shows how to print the information on a SaClmClusterNotificationBufferT structure:
The following example shows the asynchronous version of the call:
The saClmClusterNodeT structure, contained within the SA Forum/CLM API, is an important source of information about member nodes. This structure contains the following fields:
Copyright © 2008, Sun Microsystems, Inc. All rights reserved.