]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Switch to starting new event daemon
authorAmitay Isaacs <amitay@gmail.com>
Thu, 21 Jun 2018 06:38:01 +0000 (16:38 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 5 Jul 2018 04:52:43 +0000 (06:52 +0200)
From this patch onwards, CTDB daemon is broken till the client code for
new eventd is integrated.  This requires getting rid of the old eventd
protocol and client code and then switching to the new eventd protocol
and client code.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdbd.c
ctdb/server/eventscript.c

index 49e5b304d92e4913e6754f18951cb59b8c1730cd..bfdc5e032eb342bb800cf846e54fad486482a476 100644 (file)
@@ -313,20 +313,6 @@ int main(int argc, const char *argv[])
                }
        }
 
-       /*
-        * Event setup/options
-        */
-       if (ctdb_config.event_debug_script != NULL) {
-               ret = setenv("CTDB_DEBUG_HUNG_SCRIPT",
-                            ctdb_config.event_debug_script,
-                            1);
-               if (ret != 0) {
-                       D_ERR("Failed to set up event script debugging (%s)\n",
-                             strerror(errno));
-                       goto fail;
-               }
-       }
-
        /*
         * Legacy setup/options
         */
index 41807ffdcb0b7c53e571dd1db5fbdea26ea1921d..c3624f26fa8bdcb4d545dfcb850e563ea259dab5 100644 (file)
@@ -41,6 +41,7 @@
 #include "common/logging.h"
 #include "common/reqid.h"
 #include "common/sock_io.h"
+#include "common/path.h"
 
 #include "protocol/protocol_api.h"
 
 struct eventd_context {
        struct tevent_context *ev;
        const char *path;
-       const char *script_dir;
-       const char *pidfile;
        const char *socket;
-       const char *debug_hung_script;
 
        /* server state */
        pid_t eventd_pid;
@@ -71,10 +69,8 @@ static bool eventd_context_init(TALLOC_CTX *mem_ctx,
                                struct eventd_context **out)
 {
        struct eventd_context *ectx;
-       const char *eventd = CTDB_HELPER_BINDIR "/ctdb_eventd";
-       const char *debug_hung_script = CTDB_ETCDIR "/debug-hung-script.sh";
+       const char *eventd = CTDB_HELPER_BINDIR "/ctdb-eventd";
        const char *value;
-       char *socket;
        int ret;
 
        ectx = talloc_zero(mem_ctx, struct eventd_context);
@@ -95,41 +91,12 @@ static bool eventd_context_init(TALLOC_CTX *mem_ctx,
                return false;
        }
 
-       ectx->script_dir = ctdb->event_script_dir;
-
-       socket = talloc_strdup(ectx, ctdb_get_socketname(ctdb));
-       if (socket == NULL) {
-               talloc_free(ectx);
-               return false;
-       }
-
-       ectx->socket = talloc_asprintf(ectx, "%s/eventd.sock",
-                                      dirname(socket));
+       ectx->socket = path_socket(ectx, "eventd");
        if (ectx->socket == NULL) {
                talloc_free(ectx);
                return false;
        }
 
-       talloc_free(socket);
-
-       value = getenv("CTDB_DEBUG_HUNG_SCRIPT");
-       if (value != NULL) {
-               if (value[0] == '\0') {
-                       debug_hung_script = NULL;
-               } else {
-                       debug_hung_script = value;
-               }
-       }
-
-       if (debug_hung_script != NULL) {
-               ectx->debug_hung_script = talloc_strdup(ectx,
-                                                       debug_hung_script);
-               if (ectx->debug_hung_script == NULL) {
-                       talloc_free(ectx);
-                       return false;
-               }
-       }
-
        ret = reqid_init(ectx, 1, &ectx->idr);
        if (ret != 0) {
                talloc_free(ectx);
@@ -175,40 +142,23 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
                return -1;
        }
 
-       argv = talloc_array(ectx, const char *, 14);
+       argv = talloc_array(ectx, const char *, 4);
        if (argv == NULL) {
                return -1;
        }
 
        argv[0] = ectx->path;
-       argv[1] = "-e";
-       argv[2] = ectx->script_dir;
-       argv[3] = "-s";
-       argv[4] = ectx->socket;
-       argv[5] = "-P";
-       argv[6] = talloc_asprintf(argv, "%d", ctdb->ctdbd_pid);
-       argv[7] = "-l";
-       argv[8] = getenv("CTDB_LOGGING");
-       argv[9] = "-d";
-       argv[10] = debug_level_to_string(DEBUGLEVEL);
-       if (ectx->debug_hung_script == NULL) {
-               argv[11] = NULL;
-               argv[12] = NULL;
-       } else {
-               argv[11] = "-D";
-               argv[12] = ectx->debug_hung_script;
-       }
-       argv[13] = NULL;
+       argv[1] = "-P";
+       argv[2] = talloc_asprintf(argv, "%d", ctdb->ctdbd_pid);
+       argv[3] = NULL;
 
-       if (argv[6] == NULL) {
+       if (argv[2] == NULL) {
                talloc_free(argv);
                return -1;
        }
 
        DEBUG(DEBUG_NOTICE,
-             ("Starting event daemon %s %s %s %s %s %s %s %s %s %s %s\n",
-              argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
-              argv[6], argv[7], argv[8], argv[9], argv[10]));
+             ("Starting event daemon %s %s %s\n", argv[0], argv[1], argv[2]));
 
        ret = pipe(fd);
        if (ret != 0) {