Hi,
A component's restart count is not cleared, even if the node hosting it fails
over and is repaired (i.e. it reboots). This patch now clears the restart count
for the node's SUs/components after the node is repaired.
>From the sounds of SAI-AIS-AMF-B.02.01.pdf (section 3.12), the restart count
would eventually be cleared by the restart-probation period expiring (when this
is implemented). However, you'd probably still want to clear it after repairing
a node, in case the probation period was large.
This uses foreach_su_hosted_by_node() added in the last patch I sent. I've
attached the function as a separate foreachfn.patch so you can apply this patch
independently.
Thanks,
Tim
diff --git a/exec/amfnode.c b/exec/amfnode.c
index e210aad..b20a25b 100644
--- a/exec/amfnode.c
+++ b/exec/amfnode.c
@@ -301,6 +301,19 @@ out:
return has_all_sg_on_node_failed_over;
}
+/**
+ * Reset SU's restart_count after its node has been repaired
+ */
+static void su_node_repaired (struct amf_su *su)
+{
+ amf_comp_t *comp;
+
+ su->saAmfSURestartCount = 0;
+ for (comp = su->comp_head; comp != NULL; comp = comp->next) {
+ comp->saAmfCompRestartCount = 0;
+ }
+}
+
static void repair_node (amf_node_t *node)
{
ENTER("");
@@ -314,6 +327,7 @@ static void repair_node (amf_node_t *node)
system ("reboot");
#endif
}
+ foreach_su_hosted_by_node (node, su_node_repaired);
}
static void enter_failing_gracefully_rebooting_node (amf_node_t *node)
diff --git a/exec/amfnode.c b/exec/amfnode.c
index b20a25b..45d8772 100644
--- a/exec/amfnode.c
+++ b/exec/amfnode.c
@@ -203,6 +203,26 @@ LOGSYS_DECLARE_SUBSYS ("AMF", LOG_INFO)
* Internal (static) utility functions
*****************************************************************************/
+static void foreach_su_hosted_by_node (
+ struct amf_node *node,
+ void (*foreach_fn) (struct amf_su *su))
+{
+ struct amf_application *app;
+ struct amf_sg *sg;
+ struct amf_su *su;
+
+ assert (foreach_fn != NULL);
+ for (app = amf_cluster->application_head; app != NULL; app = app->next) {
+ for (sg = app->sg_head; sg != NULL; sg = sg->next) {
+ for (su = sg->su_head; su != NULL; su = su->next) {
+ if (name_match(&node->name, &su->saAmfSUHostedByNode)) {
+ foreach_fn (su);
+ }
+ }
+ }
+ }
+}
+
static void node_acsm_enter_leaving_spontaneously(struct amf_node *node)
{
ENTER("'%s'", node->name.value);
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais