當建立資源時,以及當管理動作更新該資源或其包含群組的屬性時,RGM 將呼叫 Validate 方法。 在套用建立或更新之前,RGM 將呼叫 Validate,並且在任何節點上此方法的故障退出碼將導致取消建立或更新。
僅當透過管理動作變更資源或群組屬性時,RGM 才會呼叫 Validate,而在 RGM 設定屬性或監視器設定資源屬性 Status 與 Status_msg 時,RGM 不會呼叫該方法。
每當 PROBE 方法嘗試將資料服務之故障轉移至新節點時,Monitor_check 方法都將明確地呼叫 Validate 方法。
RGM 藉由傳送至其他方法的引數以及其他引數 (包括正在更新的屬性與值),來呼叫 Validate。 xfnts_validate 開始時呼叫 scds_initialize() 會剖析 RGM 傳送至 xfnts_validate 的所有引數,並在 scds_handle 參數中儲存資訊。 xfnts_validate 呼叫的子常式將利用此資訊。
xfnts_validate 方法呼叫可確認下列內容的 svc_validate()。
已經為資源設定了 Confdir_list 屬性,該屬性定義單一目錄。
scha_str_array_t *confdirs;
confdirs = scds_get_ext_confdir_list(scds_handle);
/* Return error if there is no confdir_list extension property */
if (confdirs == NULL || confdirs->array_cnt != 1) {
scds_syslog(LOG_ERR,
"Property Confdir_list is not set properly.");
return (1); /* Validation failure */
}
Confdir_list 指定的目錄包含 fontserver.cfg 檔案。
(void) sprintf(xfnts_conf, "%s/fontserver.cfg", confdirs->str_array[0]);
if (stat(xfnts_conf, &statbuf) != 0) {
/*
* suppress lint error because errno.h prototype
* is missing void arg
*/
scds_syslog(LOG_ERR,
"Failed to access file <%s> : <%s>",
xfnts_conf, strerror(errno)); /*lint !e746 */
return (1);
}
在叢集節點上可以存取伺服器常駐程式二進位檔。
if (stat("/usr/openwin/bin/xfs", &statbuf) != 0) {
scds_syslog(LOG_ERR,
"Cannot access XFS binary : <%s> ", strerror(errno));
return (1);
}
Port_list 屬性指定單一通訊埠。
scds_port_list_t *portlist;
err = scds_get_port_list(scds_handle, &portlist);
if (err != SCHA_ERR_NOERR) {
scds_syslog(LOG_ERR,
"Could not access property Port_list: %s.",
scds_error_string(err));
return (1); /* Validation Failure */
}
#ifdef TEST
if (portlist->num_ports != 1) {
scds_syslog(LOG_ERR,
"Property Port_list must have only one value.");
scds_free_port_list(portlist);
return (1); /* Validation Failure */
}
#endif
包含資料服務的資源群組至少還包含一個網路位址資源。
scds_net_resource_list_t *snrlp;
if ((err = scds_get_rs_hostnames(scds_handle, &snrlp))
!= SCHA_ERR_NOERR) {
scds_syslog(LOG_ERR,
"No network address resource in resource group: %s.",
scds_error_string(err));
return (1); /* Validation Failure */
}
/* Return an error if there are no network address resources */
if (snrlp == NULL || snrlp->num_netresources == 0) {
scds_syslog(LOG_ERR,
"No network address resource in resource group.");
rc = 1;
goto finished;
}
在傳回之前,svc_validate() 將釋放所有分配的資源。
finished: scds_free_net_list(snrlp); scds_free_port_list(portlist); return (rc); /* return result of validation */
在結束之前,xfnts_validate 方法將呼叫 scds_close() 以回收 scds_initialize() 分配的資源。 請參閱scds_initialize() 函式與 scds_close(3HA) 線上說明手冊,以取得詳細資訊。