From: Andrew Tridgell Date: Sat, 28 Apr 2007 17:13:36 +0000 (+0200) Subject: added reset status control X-Git-Tag: tevent-0.9.20~348^2~2811 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10910f52eb1e62bf5393952f4c3a7380bf2dc548;p=thirdparty%2Fsamba.git added reset status control (This used to be ctdb commit ec342b667a085a5c740fbeec8882070571071862) --- diff --git a/ctdb/common/ctdb_client.c b/ctdb/common/ctdb_client.c index 3e3827ce69f..075f8553ae4 100644 --- a/ctdb/common/ctdb_client.c +++ b/ctdb/common/ctdb_client.c @@ -1054,3 +1054,24 @@ uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb, TALLOC_CTX *mem_ct talloc_free(map); return nodes; } + + +/* + reset remote status + */ +int ctdb_status_reset(struct ctdb_context *ctdb, uint32_t destnode) +{ + int ret; + TDB_DATA data; + int32_t res; + + ZERO_STRUCT(data); + ret = ctdb_control(ctdb, destnode, 0, + CTDB_CONTROL_STATUS_RESET, data, + NULL, NULL, &res); + if (ret != 0 || res != 0) { + DEBUG(0,(__location__ " ctdb_control for reset status failed\n")); + return -1; + } + return 0; +} diff --git a/ctdb/common/ctdb_control.c b/ctdb/common/ctdb_control.c index 731aadd5eac..306323cceb8 100644 --- a/ctdb/common/ctdb_control.c +++ b/ctdb/common/ctdb_control.c @@ -80,6 +80,12 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, return 0; } + case CTDB_CONTROL_STATUS_RESET: { + CHECK_CONTROL_DATA_SIZE(0); + ZERO_STRUCT(ctdb->status); + return 0; + } + case CTDB_CONTROL_GETVNNMAP: { uint32_t i, len; CHECK_CONTROL_DATA_SIZE(0); diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h index d512fc0e1a6..d9e53d30a94 100644 --- a/ctdb/include/ctdb.h +++ b/ctdb/include/ctdb.h @@ -256,4 +256,6 @@ int ctdb_set_debuglevel(struct ctdb_context *ctdb, uint32_t destnode, uint32_t l uint32_t *ctdb_get_connected_nodes(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, uint32_t *num_nodes); +int ctdb_status_reset(struct ctdb_context *ctdb, uint32_t destnode); + #endif diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 52a7d66f05f..f9b869c4b20 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -251,7 +251,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS, CTDB_CONTROL_GET_DEBUG, CTDB_CONTROL_SET_DEBUG, CTDB_CONTROL_GET_DBMAP, - CTDB_CONTROL_GET_NODEMAP}; + CTDB_CONTROL_GET_NODEMAP, + CTDB_CONTROL_STATUS_RESET}; enum call_state {CTDB_CALL_WAIT, CTDB_CALL_DONE, CTDB_CALL_ERROR}; diff --git a/ctdb/tools/ctdb_control.c b/ctdb/tools/ctdb_control.c index 100215e5e5c..2cb9fa5142a 100644 --- a/ctdb/tools/ctdb_control.c +++ b/ctdb/tools/ctdb_control.c @@ -36,6 +36,7 @@ static void usage(void) printf(" ping\n"); printf(" process-exists see if a process exists\n"); printf(" status show ctdb status on a node\n"); + printf(" statusreset reset status on a node\n"); printf(" debug set ctdb debug level on a node\n"); printf(" debuglevel display ctdb debug levels\n"); printf(" getvnnmap display ctdb vnnmap\n"); @@ -170,6 +171,56 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv return 0; } + +/* + reset status on all nodes + */ +static int control_status_reset_all(struct ctdb_context *ctdb) +{ + int ret, i; + uint32_t *nodes; + uint32_t num_nodes; + + nodes = ctdb_get_connected_nodes(ctdb, ctdb, &num_nodes); + CTDB_NO_MEMORY(ctdb, nodes); + + for (i=0;i