summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2013-06-18 14:27:34 +1000
committerAmitay Isaacs <amitay@gmail.com>2013-06-20 12:52:00 +1000
commita4f4e391f03eec04789811933cb5ae8405385b00 (patch)
tree642fb1e1dfd6674967f418422130026ecac092aa /ctdb
parent585a2715a6d8b4bd8bed64163c07b0ad30f38e1a (diff)
downloadsamba-a4f4e391f03eec04789811933cb5ae8405385b00.tar.gz
samba-a4f4e391f03eec04789811933cb5ae8405385b00.tar.xz
samba-a4f4e391f03eec04789811933cb5ae8405385b00.zip
tools/ctdb: Do not exit prematurely on control timeout if retrying in a loop
This avoids premature exits from "ctdb stop" and "ctdb continue" due to intermittent control (e.g. getpnn, getnodemap) timeouts. This needs a proper fix to distinguish between timeout and failure conditions and take appropriate action. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit c48583fd238496a81ddc46a21892f0b49559036a)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tools/ctdb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index b3cbade35ec..e73cbfd66ae 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -1986,7 +1986,8 @@ again:
/* get the number of nodes and node flags */
if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap) != 0) {
DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
- return -1;
+ sleep(1);
+ goto again;
}
ipreallocate_finished = false;
@@ -2879,10 +2880,9 @@ static int control_stop(struct ctdb_context *ctdb, int argc, const char **argv)
/* 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_STOPPED));
+ } while (nodemap == NULL || !(nodemap->nodes[options.pnn].flags & NODE_FLAGS_STOPPED));
ret = control_ipreallocate(ctdb, argc, argv);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("IP Reallocate failed on node %u\n", options.pnn));
@@ -2913,10 +2913,9 @@ static int control_continue(struct ctdb_context *ctdb, int argc, const char **ar
/* 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_STOPPED);
+ } while (nodemap == NULL || nodemap->nodes[options.pnn].flags & NODE_FLAGS_STOPPED);
ret = control_ipreallocate(ctdb, argc, argv);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("IP Reallocate failed on node %u\n", options.pnn));