[SCM] CTDB repository - branch master updated -
ctdb-1.0.85-24-gb99afc9
Ronnie Sahlberg
sahlberg at samba.org
Tue Jun 30 23:15:10 GMT 2009
The branch, master has been updated
via b99afc98bedf1a51d315e311f27c3fc55fd940e7 (commit)
from 964530d70ba2ca949380d30a0e3d622963a6206c (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b99afc98bedf1a51d315e311f27c3fc55fd940e7
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jul 1 09:33:08 2009 +1000
update enable/disable
-----------------------------------------------------------------------
Summary of changes:
tools/ctdb.c | 45 +++++++++++++++++++++++++++++++++++----------
1 files changed, 35 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/tools/ctdb.c b/tools/ctdb.c
index b670f92..5ca013c 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1534,12 +1534,24 @@ static int control_getpid(struct ctdb_context *ctdb, int argc, const char **argv
static int control_disable(struct ctdb_context *ctdb, int argc, const char **argv)
{
int ret;
+ struct ctdb_node_map *nodemap=NULL;
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
- if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Unable to disable node %u\n", options.pnn));
- return ret;
- }
+ do {
+ ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, NODE_FLAGS_PERMANENTLY_DISABLED, 0);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, ("Unable to disable node %u\n", options.pnn));
+ return ret;
+ }
+
+ sleep(1);
+
+ /* read the nodemap and verify the change took effect */
+ 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);
+ }
+
+ } while (!(nodemap->nodes[options.pnn].flags & NODE_FLAGS_PERMANENTLY_DISABLED));
return 0;
}
@@ -1551,11 +1563,24 @@ static int control_enable(struct ctdb_context *ctdb, int argc, const char **argv
{
int ret;
- ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
- if (ret != 0) {
- DEBUG(DEBUG_ERR, ("Unable to enable node %u\n", options.pnn));
- return ret;
- }
+ struct ctdb_node_map *nodemap=NULL;
+
+ do {
+ ret = ctdb_ctrl_modflags(ctdb, TIMELIMIT(), options.pnn, 0, NODE_FLAGS_PERMANENTLY_DISABLED);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, ("Unable to enable node %u\n", options.pnn));
+ return ret;
+ }
+
+ sleep(1);
+
+ /* read the nodemap and verify the change took effect */
+ 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);
+ }
+
+ } while (nodemap->nodes[options.pnn].flags & NODE_FLAGS_PERMANENTLY_DISABLED);
return 0;
}
--
CTDB repository
More information about the samba-cvs
mailing list