Previous  |  Next  >  
Product: Cluster Server Guides   
Manual: Cluster Server 4.1 Agent Developer's Guide   

attr_changed


 void
 res_attr_changed(const char *res_name, const char
         *changed_res_name,
         const char *changed_attr_name,
         void **new_val);

The parameter new_val contains the attribute's new value. The encoding of new_val is similar to the encoding of the ArgList Attribute.

You may select any name for the function.

The attr_changed field of VCSAgV40EntryPointStruct passed to VCSAgRegisterEPStruct() must be assigned a pointer to this function.


Note   Note    This entry point is called only if you register for change notification using the primitive VCSAgRegister, or the agent parameter RegList (see RegList).

For example:


 #include "VCSAgApi.h"

 void
  res_attr_changed(const char *res_name,
        const char *changed_res_name,
        const char *changed_attr_name,
        void **new_val) {
  // When the value of attribute Foo changes, take some action.
  if ((strcmp(res_name, changed_res_name) == 0) &&
    (strcmp(changed_attr_name, "Foo") == 0)) {
   // Extract the new value of Foo. Here, it is assumed
   // to be a string.
   const char *foo_val = (char *)new_val[0];
   // Implement the action.
    ...
  }
  // Resource Ora1 managed by this agent needs to
  // take some action when the Size attribute of
  // the resource Disk1 is changed.
  if ((strcmp(res_name, "Ora1") == 0) && 
    (strcmp(changed_attr_name, "Size") == 0) &&
    (strcmp(changed_res_name, "Disk1") == 0)) {

   // Extract the new value of Size. Here, it is
   // assumed to be an integer.
   int sizeval = atoi((char *)new_val[0]);
   // Implement the action.
    ...
  }
 }

 void VCSAgStartup() {
   VCSAgV40EntryPointStruct ep;
   ...
   ep.attr_changed =  res_attr_changed;
   ...
   VCSAgRegisterEPStruct(V40, &ep);
 }
 ^ Return to Top Previous  |  Next  >  
Product: Cluster Server Guides  
Manual: Cluster Server 4.1 Agent Developer's Guide  
VERITAS Software Corporation
www.veritas.com