mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
ctdb-daemon: Switch to starting new event daemon
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>
This commit is contained in:
parent
6eaef8491e
commit
efc5d3cadd
@ -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
|
||||
*/
|
||||
|
@ -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"
|
||||
|
||||
@ -51,10 +52,7 @@
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user