The RGM runs the Update method to notify a running resource that its properties have been changed. The RGM runs Update after the cluster administrator succeeds in setting properties of a resource or its group. This method is called on nodes where the resource is online.
The Update method does not update properties. The RGM updates properties. The Update method notifies running processes that an update has occurred. The only process in the sample data service that is affected by a property update is the fault monitor. Consequently, the fault monitor process is the process that the Update method stops and restarts.
The Update method must verify that the fault monitor is running and then kill it by using the pmfadm command. The method obtains the location of the probe program that implements the fault monitor, and restarts it by using the pmfadm command.
The Update method uses pmfadm -q to verify that the monitor is running, and if so, kills it with pmfadm -s TERM. If the monitor is successfully terminated, a message to that effect is sent to the cluster administrator. If the monitor cannot be stopped, Update exits with failure status and sends an error message to the cluster administrator.
if pmfadm -q $RESOURCE_NAME.monitor; then # Kill the monitor that is running already pmfadm -s $PMF_TAG TERM if [ $? -ne 0 ]; then logger -p ${SYSLOG_FACILITY}.err \ -t [$SYSLOG_TAG] \ "${ARGV0} Could not stop the monitor" exit 1 else # could successfully stop DNS. Log a message. logger -p ${SYSLOG_FACILITY}.err \ -t [$RESOURCETYPE_NAME,$RESOURCEGROUP_NAME,$RESOURCE_NAME] \ "Monitor for HA-DNS successfully stopped" fi
To restart the monitor, the Update method must locate the script that implements the probe program. The probe program is located in the base directory for the data service, which is pointed to by the RT_basedir property. Update retrieves the value of RT_basedir and stores it in the RT_BASEDIR variable, as follows.
RT_BASEDIR=`scha_resource_get -O RT_basedir -R $RESOURCE_NAME -G \ $RESOURCEGROUP_NAME`
Update uses the value of RT_BASEDIR with pmfadm to restart the dns_probe program. If successful, Update exits with success and sends a message to that effect to the cluster administrator. If pmfadm cannot start the probe program, Update exits with failure status and logs an error message.
Update method failure causes the resource to be put into an “update failed” state. This state has no effect on RGM management of the resource, but indicates the failure of the update action to administration tools through the syslog() function.