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

attr_changed


attr_changed resource_name changed_resource_name
  changed_attribute_name new_attribute_value

The exit value is ignored.


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

info


info resource_name resinfo_op ArgList_attribute_values

The attribute resinfo_op can be have the values 1 or 2.

Values of resinfo_op Significance

1

Add and initialize static and dynamic name-value data pairs in the ResourceInfo attribute.

2

Update just the dynamic data in the ResourceInfo attribute.

This entry point can add and update static and dynamic name-value pairs to the ResourceInfo attribute. The info entry point has no specific output, but rather, it updates the ResourceInfo attribute (see ResourceInfo).

Example Script Implementation of the Info Entry Point


#!/bin/ksh

# Parse the args to the entry point
ResName=$1;
ResInfo_op=$2;
PathName=$3;
LS="/usr/bin/ls";
HARES="/opt/VRTSvcs/bin/hares";
HAGRP="/opt/VRTSvcs/bin/hagrp";

# output of the info entry point
echo "Output of info entry point...updates the 'Msg' key in ResourceInfo attribute";

if [ -z "$PathName" ]
then
        exit 1;
else
        # Capture the info on the file
        file_info='$LS -l "$PathName" 2>/dev/null'
        res = 'echo $?'

        if [ $res -ne 0 ]
        then
                # ls failed on the pathname
                exit 1
        fi

        if [ $ResInfo_op -eq 1 ]
        then
               # Add and initialize static and dynamic data in the
              # ResourceInfo attribute

              size='echo "$file_info" | awk ' BEGIN { FS = " " }
                { print $5 } ''
              res=0

              # Fire the "hares -modify commands to add these 
              # name-value pairs to the ResourceInfo attribute

              $HARES -modify "$ResName" ResourceInfo -add
              "FileOwner" "$owner" "FileGroup" "$group" "FileSize"
             "$size"
              res='echo $?'

                if [ $res -ne 0 ]
                then
                        exit 1
                fi

        elif [ $ResInfo_op -eq 2 ]
        then
            # Update the dynamic data only in the ResourceInfo 
            # attribute.In this case, the file size is what will
            # keep changing dynamically - so update only that.

                size='echo "$file_info" | awk ' BEGIN { FS = " " }
              { print $5 } ''



           # Fire the hares -modify -update command to update 
           # the "FileSize" key in the ResourceInfo attribute 
           # with the current file size. An enhancement here 
           # is, check if the file size hasn't changed from the
           # value stored currently in the ResourceInfo 
           # attribute. If so, dont update the
           # "FileSize" key. Else, update it.

            resinfo_size='$HARES -value "$ResName" ResourceInfo |
            grep FileSize'

           # Get the FileSize value
             prev_size='echo "$file_size" | awk ' BEGIN 
             { FS = " " } { print $2 }''

             res=0
             if [ $prev_size -ne $size ]
             then
           # File size has changed =- so update the attribute
           # ResourceInfo so that it shows the latest file size

             $HARES -modify "$ResName" ResourceInfo -update
             "FileSize" "$size"
                        res='echo $?'

                        if [ $res -ne 0 ]
                        then
                                exit 1
                        fi
             fi
       fi

       #The info entry point has completed successfully.
       exit 0
fi

open


open resource_name  ArgList_attribute_values

The exit value is ignored.

close


close resource_name  ArgList_attribute_values

The exit value is ignored.

shutdown


shutdown

The exit value is ignored.

 ^ Return to Top Previous  |  Next  >  
Product: Cluster Server Guides  
Manual: Cluster Server 4.1 Agent Developer's Guide  
VERITAS Software Corporation
www.veritas.com