From: Martin Schwenke Date: Mon, 18 Apr 2016 04:26:58 +0000 (+1000) Subject: ctdb-tools: Add top-level "ctdb natgw" command X-Git-Tag: talloc-2.1.7~189 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=515e2a2d877b66d7fb3bdf86b3e03cefd16da9f6;p=thirdparty%2Fsamba.git ctdb-tools: Add top-level "ctdb natgw" command This can list the different aspects of status: master, list, status. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 7c3b5519935..fb7c468402d 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -490,6 +490,71 @@ pnn:3 192.168.2.203 OK + + natgw {master|list|status} + + This command shows different aspects of NAT gateway status. + For an overview of CTDB's NAT gateway functionality please see + the NAT GATEWAY section in + ctdb + 7. + + + + + master + + + Show the PNN and private IP address of the current NAT + gateway master node. + + + Example output: + + +1 192.168.2.201 + + + + + list + + + List the private IP addresses of nodes in the current + NAT gateway group, annotating the master node. + + + Example output: + + +192.168.2.200 +192.168.2.201 MASTER +192.168.2.202 +192.168.2.203 + + + + + status + + + List the nodes in the current NAT gateway group and + their status. + + + Example output: + + +pnn:0 192.168.2.200 UNHEALTHY (THIS NODE) +pnn:1 192.168.2.201 OK +pnn:2 192.168.2.202 OK +pnn:3 192.168.2.203 OK + + + + + + ping diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 350e2dfe5c8..f04adb122b1 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -1173,6 +1173,29 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a exit(1); } +/* Display NAT gateway status */ +static int control_natgw(struct ctdb_context *ctdb, int argc, const char **argv) +{ + static char prog[PATH_MAX+1] = ""; + + if (argc != 1) { + usage(); + } + + if (!ctdb_set_helper("NAT gateway helper", prog, sizeof(prog), + "CTDB_NATGW_HELPER", CTDB_HELPER_BINDIR, + "ctdb_natgw")) { + DEBUG(DEBUG_ERR, ("Unable to set NAT gateway helper\n")); + exit(1); + } + + execl(prog, prog, argv[0], NULL); + + DEBUG(DEBUG_ERR, + ("Unable to run NAT gateway helper %s\n", strerror(errno))); + exit(1); +} + /* display the status of the scripts for monitoring (or other events) */ @@ -5836,6 +5859,7 @@ static const struct { { "enablescript", control_enablescript, true, false, "enable an eventscript", "