good for merge On Thu, 2010-04-15 at 18:53 +1000, Angus Salkeld wrote: > else on a slow node we miss the event > > Signed-off-by: Angus Salkeld <[email protected]> > --- > cts/agents/cpg_test_agent.c | 59 ++++++++++++++++++++++++------------------ > cts/corosync.py | 10 +++--- > cts/corotests.py | 6 ++++ > 3 files changed, 45 insertions(+), 30 deletions(-) > > diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c > index 1f5babc..139b74b 100644 > --- a/cts/agents/cpg_test_agent.c > +++ b/cts/agents/cpg_test_agent.c > @@ -185,26 +185,29 @@ static void config_change_callback ( > > /* group_name,ip,pid,join|leave */ > > - if (record_config_events_g == 0) { > - return; > - } > for (i = 0; i < left_list_entries; i++) { > - syslog (LOG_DEBUG, "%s() inserting leave event into list", > __func__); > - > - log_pt = malloc (sizeof(log_entry_t)); > - list_init (&log_pt->list); > - snprintf (log_pt->log, LOG_STR_SIZE, "%s,%d,%d,left", > - groupName->value, left_list[i].nodeid,left_list[i].pid); > - list_add_tail(&log_pt->list, &config_chg_log_head); > + syslog (LOG_INFO, "%s(%d) %d:%s left", __func__, > record_config_events_g, > + left_list[i].nodeid, groupName->value); > + > + if (record_config_events_g > 0) { > + log_pt = malloc (sizeof(log_entry_t)); > + list_init (&log_pt->list); > + snprintf (log_pt->log, LOG_STR_SIZE, "%s,%d,%d,left", > + groupName->value, > left_list[i].nodeid,left_list[i].pid); > + list_add_tail(&log_pt->list, &config_chg_log_head); > + } > } > for (i = 0; i < joined_list_entries; i++) { > - syslog (LOG_DEBUG, "%s() inserting join event into list", > __func__); > - > - log_pt = malloc (sizeof(log_entry_t)); > - list_init (&log_pt->list); > - snprintf (log_pt->log, LOG_STR_SIZE, "%s,%d,%d,join", > - groupName->value, > joined_list[i].nodeid,joined_list[i].pid); > - list_add_tail (&log_pt->list, &config_chg_log_head); > + syslog (LOG_INFO, "%s(%d) %d:%s joined", __func__, > record_config_events_g, > + left_list[i].nodeid, groupName->value); > + > + if (record_config_events_g > 0) { > + log_pt = malloc (sizeof(log_entry_t)); > + list_init (&log_pt->list); > + snprintf (log_pt->log, LOG_STR_SIZE, "%s,%d,%d,join", > + groupName->value, > joined_list[i].nodeid,joined_list[i].pid); > + list_add_tail (&log_pt->list, &config_chg_log_head); > + } > } > } > > @@ -219,10 +222,15 @@ static void record_messages (void) > syslog (LOG_DEBUG,"%s() record:%d", __func__, record_messages_g); > } > > -static void record_config_events (void) > +static void record_config_events (int sock) > { > + char response[100]; > + > record_config_events_g = 1; > - syslog (LOG_DEBUG,"%s() record:%d", __func__, record_config_events_g); > + syslog (LOG_INFO, "%s() record:%d", __func__, record_config_events_g); > + > + snprintf (response, 100, "%s", OK_STR); > + send (sock, response, strlen (response), 0); > } > > static void read_config_event (int sock) > @@ -233,12 +241,12 @@ static void read_config_event (int sock) > > if (list != &config_chg_log_head) { > entry = list_entry (list, log_entry_t, list); > - send (sock, entry->log, strlen (entry->log) + 1, 0); > + send (sock, entry->log, strlen (entry->log), 0); > list_del (&entry->list); > free (entry); > } else { > syslog (LOG_DEBUG,"%s() no events in list", __func__); > - send (sock, empty, strlen (empty) + 1, 0); > + send (sock, empty, strlen (empty), 0); > } > } > > @@ -463,7 +471,7 @@ static void context_test (int sock) > else { > snprintf (response, 100, "%s", OK_STR); > } > - send (sock, response, strlen (response) + 1, 0); > + send (sock, response, strlen (response), 0); > } > > static void msg_blaster_zcb (int sock, char* num_to_send_str) > @@ -531,6 +539,7 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > "Could not join process group, error %d\n", > result); > exit (1); > } > + syslog (LOG_INFO, "called cpg_join()!"); > > } else if (strcmp ("cpg_leave",func) == 0) { > > @@ -568,7 +577,7 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > > cpg_local_get (cpg_handle, &local_nodeid); > snprintf (response, 100, "%u",local_nodeid); > - send (sock, response, strlen (response) + 1, 0); > + send (sock, response, strlen (response), 0); > } else if (strcmp ("cpg_finalize", func) == 0) { > > cpg_finalize (cpg_handle); > @@ -576,7 +585,7 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > cpg_fd = -1; > > } else if (strcmp ("record_config_events", func) == 0) { > - record_config_events (); > + record_config_events (sock); > } else if (strcmp ("record_messages", func) == 0) { > record_messages (); > } else if (strcmp ("read_config_event", func) == 0) { > @@ -591,7 +600,7 @@ static void do_command (int sock, char* func, > char*args[], int num_args) > context_test (sock); > } else if (strcmp ("are_you_ok_dude", func) == 0) { > snprintf (response, 100, "%s", OK_STR); > - send (sock, response, strlen (response) + 1, 0); > + send (sock, response, strlen (response), 0); > } else { > syslog (LOG_ERR,"%s RPC:%s not supported!", __func__, func); > } > diff --git a/cts/corosync.py b/cts/corosync.py > index 3ba1450..bb818d6 100644 > --- a/cts/corosync.py > +++ b/cts/corosync.py > @@ -423,11 +423,10 @@ class TestAgent(object): > > def stop(self): > '''Tear down (undo) the given ScenarioComponent''' > - if self.status(): > - self.env.debug('test agent: stopping %s on node %s' % > (self.binary, self.node)) > - self.sock.close () > - self.rsh(self.node, "killall " + self.binary + " 2>/dev/null") > - self.started = False > + self.env.debug('test agent: stopping %s on node %s' % (self.binary, > self.node)) > + self.sock.close () > + self.rsh(self.node, "killall " + self.binary + " 2>/dev/null") > + self.started = False > > def send (self, args): > if not self.started: > @@ -547,6 +546,7 @@ class CpgTestAgent(TestAgent): > self.send (["record_config_events", "truncate"]) > else: > self.send (["record_config_events", "append"]) > + return self.read () > > def read_config_event(self): > self.send (["read_config_event"]) > diff --git a/cts/corotests.py b/cts/corotests.py > index c1680e5..a91e0bd 100644 > --- a/cts/corotests.py > +++ b/cts/corotests.py > @@ -304,6 +304,12 @@ class CpgCfgChgOnNodeIsolate(CpgConfigChangeBase): > def __init__(self, cm): > CpgConfigChangeBase.__init__(self,cm) > self.name="CpgCfgChgOnNodeIsolate" > + > + def config_valid(self, config): > + if config.has_key('totem/rrp_mode'): > + return False > + else: > + return True > > def failure_action(self): > self.CM.log("isolating node " + self.wobbly)
_______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
