diff options
| author | Martin Schwenke <martin@meltin.net> | 2013-08-15 04:38:02 +1000 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2013-08-21 14:02:36 +1000 |
| commit | db121b4c8faa0ffa00d8b2e83a3944d2839f2ec5 (patch) | |
| tree | d1d7787bec0567a11bd8e6f256932834febaec70 | |
| parent | aa1360aeb21f73229fe7ba75d5a1019630da665e (diff) | |
| download | samba-db121b4c8faa0ffa00d8b2e83a3944d2839f2ec5.tar.gz samba-db121b4c8faa0ffa00d8b2e83a3944d2839f2ec5.tar.xz samba-db121b4c8faa0ffa00d8b2e83a3944d2839f2ec5.zip | |
tools/ctdb: Use ctdb_get_pnn() to get PNN of the current node
This has already been stored at connect time and can't fail.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit d8eb2e7fdd7645719370dad4f2faa5c3fffa8249)
| -rw-r--r-- | ctdb/tools/ctdb.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index b5807791f4..c758806916 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -1992,11 +1992,7 @@ static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char timeval_current_ofs(1, 0), ctdb_every_second, ctdb); - rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE); - if (rd.pnn == -1) { - DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n")); - return -1; - } + rd.pnn = ctdb_get_pnn(ctdb); rd.srvid = getpid(); /* register a message port for receiveing the reply so that we @@ -4169,15 +4165,9 @@ static int control_getlog(struct ctdb_context *ctdb, int argc, const char **argv TDB_DATA data; struct timeval tv; - /* Since this can fail, do it first */ - log_addr.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE); - if (log_addr.pnn == -1) { - DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n")); - return -1; - } - /* Process options */ main_daemon = true; + log_addr.pnn = ctdb_get_pnn(ctdb); log_addr.level = DEBUG_NOTICE; for (i = 0; i < argc; i++) { if (strcmp(argv[i], "recoverd") == 0) { @@ -4302,15 +4292,9 @@ static int reloadips_all(struct ctdb_context *ctdb) } } - - rips.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE); - if (rips.pnn == -1) { - DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n")); - return 1; - } + rips.pnn = ctdb_get_pnn(ctdb); rips.srvid = getpid(); - /* register a message port for receiveing the reply so that we can receive the reply */ @@ -5800,11 +5784,7 @@ static int control_rddumpmemory(struct ctdb_context *ctdb, int argc, const char TDB_DATA data; struct rd_memdump_reply rd; - rd.pnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE); - if (rd.pnn == -1) { - DEBUG(DEBUG_ERR, ("Failed to get pnn of local node\n")); - return -1; - } + rd.pnn = ctdb_get_pnn(ctdb); rd.srvid = getpid(); /* register a message port for receiveing the reply so that we @@ -5937,11 +5917,7 @@ static int control_reload_nodes_file(struct ctdb_context *ctdb, int argc, const int mypnn; struct ctdb_node_map *nodemap=NULL; - mypnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE); - if (mypnn == -1) { - DEBUG(DEBUG_ERR, ("Failed to read pnn of local node\n")); - return -1; - } + mypnn = ctdb_get_pnn(ctdb); ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap); if (ret != 0) { |
