]> git.proxmox.com Git - mirror_corosync.git/commitdiff
CTS: init votequorum by default
authorAngus Salkeld <asalkeld@redhat.com>
Fri, 27 Jan 2012 06:46:11 +0000 (17:46 +1100)
committerAngus Salkeld <asalkeld@redhat.com>
Fri, 27 Jan 2012 09:59:22 +0000 (20:59 +1100)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
cts/agents/votequorum_test_agent.c
cts/corosync.py

index f0dcb010b03953ccc192a9cd053a77a8c8c6380b..b27d1da17479f7ade0a8b90a1decc4213a9098a3 100644 (file)
@@ -88,8 +88,6 @@ static int vq_dispatch_wrapper_fn (
                qb_log (LOG_ERR, "got %s error, disconnecting.",
                        cs_strerror(error));
                votequorum_finalize(vq_handle);
-               qb_loop_poll_del (ta_poll_handle_get(), fd);
-               close (fd);
                vq_handle = 0;
                return -1;
        }
@@ -106,8 +104,6 @@ static int q_dispatch_wrapper_fn (
                qb_log (LOG_ERR, "got %s error, disconnecting.",
                        cs_strerror(error));
                quorum_finalize(q_handle);
-               qb_loop_poll_del (ta_poll_handle_get(), fd);
-               close (fd);
                q_handle = 0;
                return -1;
        }
@@ -171,22 +167,6 @@ static int q_lib_init(void)
        return ret;
 }
 
-static void lib_init (int sock)
-{
-       int ret;
-       char response[100];
-
-       snprintf (response, 100, "%s", OK_STR);
-       ret = q_lib_init ();
-
-       if (ret != CS_OK) {
-               snprintf (response, 100, "%s", FAIL_STR);
-               qb_log (LOG_ERR, "q_lib_init FAILED: %d", ret);
-       }
-
-       send (sock, response, strlen (response), 0);
-}
-
 static void getinfo (int sock)
 {
        int ret;
@@ -280,21 +260,25 @@ static void context_test (int sock)
 {
        char response[100];
        char *cmp;
+       cs_error_t rc1;
+       cs_error_t rc2;
 
        snprintf (response, 100, "%s", OK_STR);
 
-       votequorum_context_set (vq_handle, response);
-       votequorum_context_get (vq_handle, (void**)&cmp);
+       rc1 = votequorum_context_set (vq_handle, response);
+       rc2 = votequorum_context_get (vq_handle, (void**)&cmp);
        if (response != cmp) {
                snprintf (response, 100, "%s", FAIL_STR);
-               qb_log (LOG_ERR, "votequorum context not the same");
+               qb_log (LOG_ERR, "votequorum context not the same %d %d",
+                       rc1, rc2);
        }
 
-       quorum_context_set (q_handle, response);
-       quorum_context_get (q_handle, (const void**)&cmp);
+       rc1 = quorum_context_set (q_handle, response);
+       rc2 = quorum_context_get (q_handle, (const void**)&cmp);
        if (response != cmp) {
                snprintf (response, 100, "%s", FAIL_STR);
-               qb_log (LOG_ERR, "quorum context not the same");
+               qb_log (LOG_ERR, "quorum context not the same %d %d",
+                       rc1, rc2);
        }
        send (sock, response, strlen (response) + 1, 0);
 }
@@ -303,6 +287,8 @@ static void do_command (int sock, char* func, char*args[], int num_args)
 {
        char response[100];
 
+       q_lib_init ();
+
        qb_log (LOG_INFO,"RPC:%s() called.", func);
 
        if (strcmp ("votequorum_getinfo", func) == 0) {
@@ -313,11 +299,10 @@ static void do_command (int sock, char* func, char*args[], int num_args)
                setexpected (sock, args[0]);
        } else if (strcmp ("quorum_getquorate", func) == 0) {
                getquorate (sock);
-       } else if (strcmp ("init", func) == 0) {
-               lib_init (sock);
        } else if (strcmp ("context_test", func) == 0) {
                context_test (sock);
-       } else if (strcmp ("are_you_ok_dude", func) == 0) {
+       } else if (strcmp ("are_you_ok_dude", func) == 0 ||
+                  strcmp ("init", func) == 0) {
                snprintf (response, 100, "%s", OK_STR);
                send (sock, response, strlen (response) + 1, 0);
        } else {
index b8c4edbf0d870acf593f0698a20e2a158d9b41ed..b91843a8a35b0f55400831ac7dbed8c2f65bfd7b 100644 (file)
@@ -655,12 +655,6 @@ class VoteQuorumTestAgent(TestAgent):
         self.nodeid = None
         self.send_recv = True
 
-    def start(self):
-        if not self.started:
-            TestAgent.start(self)
-            self.init()
-            self.used = False
-
 AllAuditClasses = []
 AllAuditClasses.append(LogAudit)
 AllAuditClasses.append(ShmLeakAudit)