This patch allows a component to start before AMF
and poll the saAmfComponetRegister() function.
-Angus
Index: services/amf.c
===================================================================
--- services/amf.c (revision 1791)
+++ services/amf.c (working copy)
@@ -1843,7 +1843,16 @@
struct req_lib_amf_componentregister *req_lib = msg;
struct amf_comp *comp;
- assert (scsm.state == NORMAL_OPERATION);
+ if ((scsm.state != NORMAL_OPERATION) ||
+ (amf_cluster == NULL)) {
+ struct res_lib_amf_componentregister res_lib;
+ res_lib.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
+ res_lib.header.size = sizeof (struct
res_lib_amf_componentregister);
+ res_lib.header.error = SA_AIS_ERR_TRY_AGAIN;
+ openais_conn_send_response (
+ conn, &res_lib, sizeof (struct
res_lib_amf_componentregister));
+ return;
+ }
comp = amf_comp_find (amf_cluster, &req_lib->compName);
if (comp) {
@@ -2243,7 +2252,16 @@
amf_comp_t *reporting_comp;
SaNameT reporting_comp_name;
- assert (scsm.state == NORMAL_OPERATION);
+ if ((scsm.state != NORMAL_OPERATION) ||
+ (amf_cluster == NULL)) {
+ struct res_lib_amf_componentregister res_lib;
+ res_lib.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
+ res_lib.header.size = sizeof (struct
res_lib_amf_componentregister);
+ res_lib.header.error = SA_AIS_ERR_TRY_AGAIN;
+ openais_conn_send_response (
+ conn, &res_lib, sizeof (struct
res_lib_amf_componentregister));
+ return;
+ }
comp = amf_comp_find (amf_cluster, &req_lib->erroneousComponent);
reporting_comp = amf_comp_find_from_conn_info (conn);
Index: services/amfcomp.c
===================================================================
--- services/amfcomp.c (revision 1791)
+++ services/amfcomp.c (working copy)
@@ -1267,6 +1267,9 @@
case SA_AMF_PRESENCE_RESTARTING:
comp_presence_state_set (comp,
SA_AMF_PRESENCE_INSTANTIATED);
break;
+ case SA_AMF_PRESENCE_UNINSTANTIATED:
+ /* wait until amf thinks it's instantitating */
+ return SA_AIS_ERR_TRY_AGAIN;
case SA_AMF_PRESENCE_INSTANTIATING:
amf_comp_operational_state_set (comp,
SA_AMF_OPERATIONAL_ENABLED);
comp_presence_state_set (comp,
SA_AMF_PRESENCE_INSTANTIATED);
@@ -1279,9 +1282,7 @@
comp->saAmfCompPresenceState);
assert (0);
break;
-
}
-
return SA_AIS_OK;
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais