Oracle® Solaris Cluster Reference Manual

Exit Print View

Updated: July 2014, E39662-01
 
 

scha_get_fullname (3HA)

Name

scha_get_fullname - return the cluster node name in which a resource group executes

Synopsis

scha_err_tscha_get_fullname(const char *zonename, char **fullname)

Description

The scha_get_fullname() function returns the logical node name of a zone context on the local node. The out-parameter fullname is set to a string containing a cluster node name. The string needs to be freed by the caller.

If zonename is NULL, the zone context depends on where this call is executed.

  • If executed in the global zone, it returns the local node name.

  • If executed in a zone cluster, it returns the zone-cluster node name, not the global-cluster node name.

If zonename is non-NULL, this is meant to be called in the global zone on behalf of a resource configured in the non-global zone specified by zonename.If zonename is the name of a zone cluster, which is also the name of the underlying non-global zone, it returns the zone-cluster node name.

If this function is called from a resource callback method and the zonename parameter is set to the output of the scds_get_zone_name() function, the resulting fullname will match the current entry in the resource-group node list in all cases:

  • Global cluster or zone cluster

  • global_zone resource type or normal resource type

Return Values

This 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_get_fullname() Function

The following example uses scha_get_fullname() to obtain a fullname string representing the nodename context in which the current program is executing, and searches for this name in the resource group's node list:

       #include <scha.h>
       #include <libdsdev.h>

       main(int argc, char *argv[])

       {
               scha_err_t        err;
               scds_handle_t     handle;
               char              *myzonename;
               char              *fullname;
               const scha_str_array_t  *rgnodelist;
               uint_t            ix;

               if (scds_initialize(&handle) != SCHA_ERR_NOERR) {
                       /* handle the error */
                       ...
               }
               myzonename = scds_get_zone_name(handle);
               rgnodelist = scds_get_rg_nodelist(handle);
               err = scha_get_fullname(myzonename, &fullname);
               ...
               for (ix = 0; ix < rgnodelist->array_cnt; ix++) {
                       if (strcmp(fullname, rgnodelist->str_array[ix]) == 0) {
                               /* found this node in the node list */
                               ...
                       }
               }
               ...
       }

Attributes

See attributes (5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
ha-cluster/developer/api
Interface Stability
Evolving

See also

scds_calls(3HA), scds_initialize(3HA), scha_cluster_getnodename(3HA), attributes (5)