1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

LibCTDB : uptade the ctdb tool to use libctdb to query for the recmaster

(This used to be ctdb commit 81c14c8625a6d5670b8795a655d7a3f3318009e5)
This commit is contained in:
Ronnie Sahlberg 2011-08-23 16:32:38 +10:00
parent 7e29817f61
commit 75afbee956

View File

@ -744,10 +744,9 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
}
printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
if (!ctdb_getrecmaster(ctdb_connection, options.pnn, &recmaster)) {
DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
return ret;
return -1;
}
printf("Recovery master:%d\n",recmaster);
@ -1095,13 +1094,11 @@ static int control_disablescript(struct ctdb_context *ctdb, int argc, const char
*/
static int control_recmaster(struct ctdb_context *ctdb, int argc, const char **argv)
{
int ret;
uint32_t recmaster;
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
if (!ctdb_getrecmaster(ctdb_connection, options.pnn, &recmaster)) {
DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
return ret;
return -1;
}
printf("%d\n",recmaster);
@ -1596,10 +1593,9 @@ again:
}
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
if (!ctdb_getrecmaster(ctdb_connection, options.pnn, &recmaster)) {
DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
return ret;
return -1;
}
/* verify the node exists */
@ -2543,8 +2539,7 @@ static uint32_t get_generation(struct ctdb_context *ctdb)
}
/* get the recmaster */
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, &recmaster);
if (ret != 0) {
if (!ctdb_getrecmaster(ctdb_connection, CTDB_CURRENT_NODE, &recmaster)) {
DEBUG(DEBUG_ERR, ("Unable to get recmaster from node %u\n", options.pnn));
exit(10);
}
@ -3593,7 +3588,6 @@ static int control_getdbstatus(struct ctdb_context *ctdb, int argc, const char *
static int control_isnotrecmaster(struct ctdb_context *ctdb, int argc, const char **argv)
{
uint32_t mypnn, recmaster;
int ret;
mypnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
if (mypnn == -1) {
@ -3601,8 +3595,7 @@ static int control_isnotrecmaster(struct ctdb_context *ctdb, int argc, const cha
return 1;
}
ret = ctdb_ctrl_getrecmaster(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmaster);
if (ret != 0) {
if (!ctdb_getrecmaster(ctdb_connection, options.pnn, &recmaster)) {
printf("Failed to get the recmaster\n");
return 1;
}