From 7a889c5f1d652ac19ab5592e08738246eab80dc7 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 4 Feb 2010 10:03:21 +1100 Subject: [PATCH] When trying to enable/disable a node. Check if the node is already enabled/disabled and log an information message if so. (This used to be ctdb commit c3eec8f10764a647106087099eeb47b7196f7aac) --- ctdb/tools/ctdb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 9d6547c55c8..1c760d40a80 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -2085,6 +2085,16 @@ static int control_disable(struct ctdb_context *ctdb, int argc, const char **arg int ret; struct ctdb_node_map *nodemap=NULL; + /* check if the node is already disabled */ + if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap) != 0) { + DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n")); + exit(10); + } + if (nodemap->nodes[options.pnn].flags & NODE_FLAGS_PERMANENTLY_DISABLED) { + DEBUG(DEBUG_ERR,("Node %d is already disabled.\n", options.pnn)); + return 0; + } + do { ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0); if (ret != 0) { @@ -2119,6 +2129,16 @@ static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv struct ctdb_node_map *nodemap=NULL; + /* check if the node is already enabled */ + if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap) != 0) { + DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n")); + exit(10); + } + if (!(nodemap->nodes[options.pnn].flags & NODE_FLAGS_PERMANENTLY_DISABLED)) { + DEBUG(DEBUG_ERR,("Node %d is already enabled.\n", options.pnn)); + return 0; + } + do { ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED); if (ret != 0) {