diff options
| author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-07-10 10:37:22 +1000 |
|---|---|---|
| committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-07-10 10:37:22 +1000 |
| commit | ab8535eaa5073737391a6d160e6f34377061d20e (patch) | |
| tree | 2fce9e43d09135597efede6bed758a71158e1758 | |
| parent | 3c0d725e0bd4efd744d2d3c3a8293ede8203437b (diff) | |
| download | samba-ab8535eaa5073737391a6d160e6f34377061d20e.tar.gz samba-ab8535eaa5073737391a6d160e6f34377061d20e.tar.xz samba-ab8535eaa5073737391a6d160e6f34377061d20e.zip | |
make LVS a capability so that we can see which nodes are configured with
LVS and which are not using LVS.
"ctdb getcapabilities"
(This used to be ctdb commit 172d01fb34f032e098b1c77a7b0f17bf11301640)
| -rwxr-xr-x | ctdb/config/ctdb.init | 3 | ||||
| -rw-r--r-- | ctdb/include/ctdb_private.h | 2 | ||||
| -rw-r--r-- | ctdb/server/ctdbd.c | 5 | ||||
| -rw-r--r-- | ctdb/tools/ctdb.c | 8 |
4 files changed, 15 insertions, 3 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init index 760d6de5e9..72de84d082 100755 --- a/ctdb/config/ctdb.init +++ b/ctdb/config/ctdb.init @@ -72,6 +72,9 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK" [ -z "$CTDB_CAPABILITY_LMASTER" ] || [ "$CTDB_CAPABILITY_LMASTER" != "no" ] || { CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster" } +[ -z "$CTDB_LVS_PUBLIC_IP" ] || { + CTDB_OPTIONS="$CTDB_OPTIONS --lvs" +} if [ "$CTDB_VALGRIND" = "yes" ]; then init_style="valgrind" diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index ad4805fcef..4124f649fc 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -355,6 +355,8 @@ enum ctdb_freeze_mode {CTDB_FREEZE_NONE, CTDB_FREEZE_PENDING, CTDB_FREEZE_FROZEN /* The different capabilities of the ctdb daemon. */ #define CTDB_CAP_RECMASTER 0x00000001 #define CTDB_CAP_LMASTER 0x00000002 +/* This capability is set if CTDB_LVS_PUBLIC_IP is set */ +#define CTDB_CAP_LVS 0x00000004 /* main state of the ctdb daemon */ struct ctdb_context { diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index aa5253ac1d..b7979049c1 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -45,6 +45,7 @@ static struct { int start_as_disabled; int no_lmaster; int no_recmaster; + int lvs; } options = { .nlist = ETCDIR "/ctdb/nodes", .transport = "tcp", @@ -124,6 +125,7 @@ int main(int argc, const char *argv[]) { "start-as-disabled", 0, POPT_ARG_NONE, &options.start_as_disabled, 0, "Node starts in disabled state", NULL }, { "no-lmaster", 0, POPT_ARG_NONE, &options.no_lmaster, 0, "disable lmaster role on this node", NULL }, { "no-recmaster", 0, POPT_ARG_NONE, &options.no_recmaster, 0, "disable recmaster role on this node", NULL }, + { "lvs", 0, POPT_ARG_NONE, &options.lvs, 0, "lvs is enabled on this node", NULL }, POPT_TABLEEND }; int opt, ret; @@ -213,6 +215,9 @@ int main(int argc, const char *argv[]) if (options.no_recmaster == 0) { ctdb->capabilities |= CTDB_CAP_RECMASTER; } + if (options.lvs != 0) { + ctdb->capabilities |= CTDB_CAP_LVS; + } /* tell ctdb what nodes are available */ ctdb_load_nodes_file(ctdb); diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 1d77707936..ba7bc5dc28 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -1226,11 +1226,13 @@ static int control_getcapabilities(struct ctdb_context *ctdb, int argc, const ch if (!options.machinereadable){ printf("RECMASTER: %s\n", (capabilities&CTDB_CAP_RECMASTER)?"YES":"NO"); printf("LMASTER: %s\n", (capabilities&CTDB_CAP_LMASTER)?"YES":"NO"); + printf("LVS: %s\n", (capabilities&CTDB_CAP_LVS)?"YES":"NO"); } else { - printf(":RECMASTER:LMASTER:\n"); - printf(":%d:%d:\n", + printf(":RECMASTER:LMASTER:LVS:\n"); + printf(":%d:%d:%d:\n", !!(capabilities&CTDB_CAP_RECMASTER), - !!(capabilities&CTDB_CAP_LMASTER)); + !!(capabilities&CTDB_CAP_LMASTER), + !!(capabilities&CTDB_CAP_LVS)); } return 0; } |
