</refsect2>
<refsect2>
- <title>lvsmaster</title>
+ <title>lvs {master|list|status}</title>
<para>
- This command shows which node is currently the LVSMASTER. The
- LVSMASTER is the node in the cluster which drives the LVS system and
- which receives all incoming traffic from clients.
- </para>
- <para>
- LVS is the mode where the entire CTDB/Samba cluster uses a single
- ip address for the entire cluster. In this mode all clients connect to
- one specific node which will then multiplex/loadbalance the clients
- evenly onto the other nodes in the cluster. This is an alternative to using
- public ip addresses. See the manpage for ctdbd for more information
- about LVS.
- </para>
- </refsect2>
-
- <refsect2>
- <title>lvs</title>
- <para>
- This command shows which nodes in the cluster are currently active in the
- LVS configuration. I.e. which nodes we are currently loadbalancing
- the single ip address across.
+ This command shows different aspects of LVS status. For an
+ overview of CTDB's LVS functionality please see the
+ <citetitle>LVS</citetitle> section in
+ <citerefentry><refentrytitle>ctdb</refentrytitle>
+ <manvolnum>7</manvolnum></citerefentry>.
</para>
+ <variablelist>
+ <varlistentry>
+ <term>master</term>
+ <listitem>
+ <para>
+ Shows the PNN of the current LVS master node.
+ </para>
<para>
- LVS will by default only loadbalance across those nodes that are both
- LVS capable and also HEALTHY. Except if all nodes are UNHEALTHY in which
- case LVS will loadbalance across all UNHEALTHY nodes as well.
- LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or
- DISABLED.
+ Example output:
</para>
-
+ <screen>
+Node 2 is LVS master
+ </screen>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>list</term>
+ <listitem>
+ <para>
+ Lists the currently usable LVS nodes.
+ </para>
<para>
Example output:
</para>
2:10.0.0.13
3:10.0.0.14
</screen>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>status</term>
+ <listitem>
+ <para>
+ List the nodes in the current LVS group and their status.
+ </para>
+ <para>
+ Example output:
+ </para>
+ <screen>
+pnn:0 10.0.0.11 UNHEALTHY (THIS NODE)
+pnn:1 10.0.0.12 UNHEALTHY
+pnn:2 10.0.0.13 OK
+pnn:3 10.0.0.14 OK
+ </screen>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsect2>
setup_lvs <<EOF
EOF
-required_result 0 <<EOF
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
0
1
2
+"
+
+#####
+
+required_result 255 <<EOF
+There is no LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 0 <<EOF
-0:192.168.20.41
-1:192.168.20.42
-2:192.168.20.43
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
0
1
2
+"
+
+#####
+
+required_result 0 <<EOF
+Node 0 is LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+0:192.168.20.41
+1:192.168.20.42
+2:192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:1 192.168.20.42 OK
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 0 <<EOF
-0:192.168.20.41
-2:192.168.20.43
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x0 CURRENT RECMASTER
1 192.168.20.42 0x0
0
1
2
+"
+#####
+
+required_result 0 <<EOF
+Node 0 is LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+0:192.168.20.41
+2:192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 0 <<EOF
-Node 1 is LVS master
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x2 CURRENT RECMASTER
1 192.168.20.42 0x0
0
1
2
+"
+
+#####
+
+required_result 0 <<EOF
+Node 1 is LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+1:192.168.20.42
+2:192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 UNHEALTHY (THIS NODE)
+pnn:1 192.168.20.42 OK
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 0 <<EOF
-Node 0 is LVS master
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x2 CURRENT RECMASTER
1 192.168.20.42 0x2
0
1
2
+"
+
+#####
+
+required_result 0 <<EOF
+Node 0 is LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+0:192.168.20.41
+1:192.168.20.42
+2:192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 UNHEALTHY (THIS NODE)
+pnn:1 192.168.20.42 UNHEALTHY
+pnn:2 192.168.20.43 UNHEALTHY
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 0 <<EOF
-Node 2 is LVS master
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x4 CURRENT RECMASTER
1 192.168.20.42 0x4
0
1
2
+"
+
+#####
+
+required_result 0 <<EOF
+Node 2 is LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+2:192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 DISABLED (THIS NODE)
+pnn:1 192.168.20.42 DISABLED
+pnn:2 192.168.20.43 UNHEALTHY
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
192.168.20.43
EOF
-required_result 255 <<EOF
-There is no LVS master
-EOF
-
-simple_test <<EOF
+ctdb_state="\
NODEMAP
0 192.168.20.41 0x4 CURRENT RECMASTER
1 192.168.20.42 0x4
0
1
2
+"
+
+#####
+
+required_result 255 <<EOF
+There is no LVS master
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 DISABLED (THIS NODE)
+pnn:1 192.168.20.42 DISABLED
+pnn:2 192.168.20.43 DISABLED
+EOF
+
+simple_test status <<EOF
+$ctdb_state
EOF
--- /dev/null
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, no LVS, current disconnected"
+
+setup_lvs <<EOF
+EOF
+
+ctdb_state="\
+NODEMAP
+0 192.168.20.41 0x1 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+"
+
+#####
+
+required_result 10 <<EOF
+${TEST_DATE_STAMP}Unable to get nodemap from local node
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 10 <<EOF
+${TEST_DATE_STAMP}Unable to get nodemap from local node
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 10 <<EOF
+${TEST_DATE_STAMP}Unable to get nodemap from local node
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 10 <<EOF
+${TEST_DATE_STAMP}Unable to get nodemap from local node
+EOF
+
+simple_test status <<EOF
+$ctdb_state
+EOF
+++ /dev/null
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "3 nodes, no LVS, all ok"
-
-setup_lvs <<EOF
-EOF
-
-required_result 255 <<EOF
-There is no LVS master
-EOF
-
-simple_test <<EOF
-NODEMAP
-0 192.168.20.41 0x0 CURRENT RECMASTER
-1 192.168.20.42 0x0
-2 192.168.20.43 0x0
-
-IFACES
-:Name:LinkStatus:References:
-:eth2:1:2:
-:eth1:1:4:
-
-VNNMAP
-654321
-0
-1
-2
-EOF
+++ /dev/null
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "3 nodes, current disconnected"
-
-setup_lvs <<EOF
-EOF
-
-required_result 10 <<EOF
-${TEST_DATE_STAMP}Unable to get nodemap from local node
-EOF
-
-simple_test -Y <<EOF
-NODEMAP
-0 192.168.20.41 0x1 CURRENT RECMASTER
-1 192.168.20.42 0x0
-2 192.168.20.43 0x0
-
-IFACES
-:Name:LinkStatus:References:
-:eth2:1:2:
-:eth1:1:4:
-
-VNNMAP
-654321
-0
-1
-2
-EOF
+++ /dev/null
-#!/bin/sh
-
-. "${TEST_SCRIPTS_DIR}/unit.sh"
-
-define_test "3 nodes, all LVS, all ok"
-
-setup_lvs <<EOF
-192.168.20.41
-192.168.20.42
-192.168.20.43
-EOF
-
-required_result 0 <<EOF
-Node 0 is LVS master
-EOF
-
-simple_test <<EOF
-NODEMAP
-0 192.168.20.41 0x0 CURRENT RECMASTER
-1 192.168.20.42 0x0
-2 192.168.20.43 0x0
-
-IFACES
-:Name:LinkStatus:References:
-:eth2:1:2:
-:eth1:1:4:
-
-VNNMAP
-654321
-0
-1
-2
-EOF
return 0;
}
-/* display lvs configuration */
+/* Display LVS status */
static int control_lvs(struct ctdb_context *ctdb,
int argc, const char **argv)
{
static char prog[PATH_MAX+1] = "";
- if (argc != 0) {
- usage();
- }
-
- if (!ctdb_set_helper("LVS helper", prog, sizeof(prog),
- "CTDB_LVS_HELPER", CTDB_HELPER_BINDIR,
- "ctdb_lvs")) {
- DEBUG(DEBUG_ERR, ("Unable to set LVS helper\n"));
- exit(1);
- }
-
- execl(prog, prog, "list", NULL);
-
- DEBUG(DEBUG_ERR,
- ("Unable to run LVS helper %s\n", strerror(errno)));
- exit(1);
-}
-
-/* display who the lvs is */
-static int control_lvsmaster(struct ctdb_context *ctdb,
- int argc, const char **argv)
-{
- static char prog[PATH_MAX+1] = "";
-
- if (argc != 0) {
+ if (argc != 1) {
usage();
}
exit(1);
}
- execl(prog, prog, "master", NULL);
+ execl(prog, prog, argv[0], NULL);
DEBUG(DEBUG_ERR,
("Unable to run LVS helper %s\n", strerror(errno)));
{ "getmonmode", control_getmonmode, true, false, "show monitoring mode" },
{ "getcapabilities", control_getcapabilities, true, false, "show node capabilities" },
{ "pnn", control_pnn, true, false, "show the pnn of the currnet node" },
- { "lvs", control_lvs, false, true, "show lvs configuration" },
- { "lvsmaster", control_lvsmaster, false, true, "show which node is the lvs master" },
+ { "lvs", control_lvs, false, true, "show lvs configuration", "[master|list|status]" },
{ "disablemonitor", control_disable_monmode,true, false, "set monitoring mode to DISABLE" },
{ "enablemonitor", control_enable_monmode, true, false, "set monitoring mode to ACTIVE" },
{ "setdebug", control_setdebug, true, false, "set debug level", "<EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUG>" },