[SCM] CTDB repository - branch master updated - ctdb-1.0.113-70-gc3eec8f

Ronnie Sahlberg sahlberg at samba.org
Wed Feb 3 16:04:38 MST 2010


The branch, master has been updated
       via  c3eec8f10764a647106087099eeb47b7196f7aac (commit)
      from  59ba5d7f80e0465e5076533374fb9ee862ed7bb6 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c3eec8f10764a647106087099eeb47b7196f7aac
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Feb 4 10:03:21 2010 +1100

    When trying to enable/disable a node.
    Check if the node is already enabled/disabled and log an information
    message if so.

-----------------------------------------------------------------------

Summary of changes:
 tools/ctdb.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/ctdb.c b/tools/ctdb.c
index 9d6547c..1c760d4 100644
--- a/tools/ctdb.c
+++ b/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) {


-- 
CTDB repository


More information about the samba-cvs mailing list