diff options
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/config/functions | 19 | ||||
-rw-r--r-- | ctdb/include/ctdb_private.h | 4 | ||||
-rw-r--r-- | ctdb/server/eventscript.c | 22 |
3 files changed, 37 insertions, 8 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions index ce667010b7..93b50af525 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -459,13 +459,18 @@ ctdb_status_dir="$ctdb_spool_dir/status" ctdb_fail_dir="$ctdb_spool_dir/failcount" ctdb_active_dir="$ctdb_spool_dir/active" +log_status_cat () +{ + echo "node is \"$1\", problem with \"${script_name}\": $(cat $2)" +} + ctdb_checkstatus () { - if [ -r "$ctdb_status_dir/$service_name/unhealthy" ] ; then - log_status_cat "unhealthy" "$ctdb_status_dir/$service_name/unhealthy" + if [ -r "$ctdb_status_dir/$script_name/unhealthy" ] ; then + log_status_cat "unhealthy" "$ctdb_status_dir/$script_name/unhealthy" return 1 - elif [ -r "$ctdb_status_dir/$service_name/banned" ] ; then - log_status_cat "banned" "$ctdb_status_dir/$service_name/banned" + elif [ -r "$ctdb_status_dir/$script_name/banned" ] ; then + log_status_cat "banned" "$ctdb_status_dir/$script_name/banned" return 2 else return 0 @@ -474,7 +479,7 @@ ctdb_checkstatus () ctdb_setstatus () { - d="$ctdb_status_dir/$service_name" + d="$ctdb_status_dir/$script_name" case "$1" in unhealthy|banned) mkdir -p "$d" @@ -534,6 +539,7 @@ is_ctdb_managed_service () ctdb_compat_managed_service "$CTDB_MANAGES_HTTPD" "httpd" ctdb_compat_managed_service "$CTDB_MANAGES_ISCSI" "iscsi" ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD" "clamd" + ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs" # Returns 0 if "<space>$service_name<space>" appears in $t [ "${t#* ${service_name} }" != "${t}" ] @@ -595,7 +601,8 @@ ctdb_service_stop () } # A reasonable default is the basename of the eventscript. -service_name="${0##*/}" # basename +script_name="${0##*/}" # basename +service_name="$script_name" service_fail_limit=1 ctdb_event="$1" ; shift diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 4136bd5da7..05b288a08a 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -454,8 +454,8 @@ struct ctdb_context { TALLOC_CTX *monitor_event_script_ctx; TALLOC_CTX *other_event_script_ctx; - struct ctdb_monitor_script_status_ctx *current_monitor_status_ctx; - struct ctdb_monitor_script_status_ctx *last_monitor_status_ctx; + struct ctdb_monitor_script_status_ctx *current_monitor_status_ctx; + struct ctdb_monitor_script_status_ctx *last_monitor_status_ctx; TALLOC_CTX *banning_ctx; }; diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index 24e08f0cf5..e04dd48db1 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -809,7 +809,12 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, ctdb->current_monitor_status_ctx = NULL; } +<<<<<<< HEAD:server/eventscript.c ctdb->current_monitor_status_ctx = talloc(ctdb->monitor_event_script_ctx, struct ctdb_monitor_script_status_ctx); +======= + ctdb->current_monitor_status_ctx = talloc(ctdb, struct ctdb_monitor_script_status_ctx); + CTDB_NO_MEMORY(ctdb, ctdb->current_monitor_status_ctx); +>>>>>>> martins-svart/status-test-2:server/eventscript.c ctdb->current_monitor_status_ctx->scripts = NULL; } else { /* any other script will first terminate any monitor event */ @@ -818,11 +823,17 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, ctdb->monitor_event_script_ctx = NULL; } /* and then use a context common for all non-monitor events */ +<<<<<<< HEAD:server/eventscript.c if (ctdb->other_event_script_ctx != NULL) { talloc_free(ctdb->other_event_script_ctx); ctdb->other_event_script_ctx = NULL; } ctdb->other_event_script_ctx = talloc_new(ctdb); +======= + if (ctdb->other_event_script_ctx == NULL) { + ctdb->other_event_script_ctx = talloc_new(ctdb); + } +>>>>>>> martins-svart/status-test-2:server/eventscript.c mem_ctx = ctdb->other_event_script_ctx; } @@ -994,7 +1005,11 @@ static void run_eventscripts_callback(struct ctdb_context *ctdb, int status, return; } +<<<<<<< HEAD:server/eventscript.c +======= +/* Returns rest of string, or NULL if no match. */ +>>>>>>> martins-svart/status-test-2:server/eventscript.c static const char *get_call(const char *p, enum ctdb_eventscript_call *call) { unsigned int len; @@ -1006,6 +1021,7 @@ static const char *get_call(const char *p, enum ctdb_eventscript_call *call) for (*call = 0; *call < ARRAY_SIZE(call_names); (*call)++) { len = strlen(call_names[*call]); if (strncmp(p, call_names[*call], len) == 0) { +<<<<<<< HEAD:server/eventscript.c /* If that's it, we're good. */ if (*p == '\0') return p; @@ -1014,6 +1030,12 @@ static const char *get_call(const char *p, enum ctdb_eventscript_call *call) if (len) return p + len; /* Hmm, extra chars: keep looking. */ +======= + /* If end of string or whitespace, we're done. */ + if (strcspn(p + len, " \t") == 0) { + return p + len; + } +>>>>>>> martins-svart/status-test-2:server/eventscript.c } } return NULL; |