6 Verify that NFS connections are monitored and that NFS tickles are sent.
8 We create a connection to the NFS server on a node and confirm that
9 this connection is registered in the nfs-tickles/ subdirectory in
10 shared storage. Then disable the relevant NFS server node and ensure
11 that it send an appropriate reset packet.
15 * An active CTDB cluster with at least 2 nodes with public addresses.
17 * Test must be run on a real or virtual cluster rather than against
20 * Test must not be run from a cluster node.
22 * Cluster nodes must be listening on the NFS TCP port (2049).
26 1. Verify that the cluster is healthy.
27 2. Connect from the current host (test client) to TCP port 2049 using
28 the public address of a cluster node.
29 3. Determine the source socket used for the connection.
30 4. Ensure that CTDB records the source socket details in the nfs-tickles
31 directory on shared storage.
32 5. Disable the node that the connection has been made to.
33 6. Verify that a TCP tickle (a reset packet) is sent to the test client.
37 * CTDB should correctly record the socket in the nfs-tickles directory
38 and should send a reset packet when the node is disabled.
42 . ctdb_test_functions.bash
48 ctdb_test_check_real_cluster
53 ctdb_restart_when_done
55 ctdb_test_exit_hook_add ctdb_test_eventscript_uninstall
57 ctdb_test_eventscript_install
59 # We need this for later, so we know how long to sleep.
60 try_command_on_node any $CTDB getvar MonitorInterval
61 monitor_interval="${out#*= }"
62 #echo "Monitor interval on node $test_node is $monitor_interval seconds."
64 select_test_node_and_ips
68 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
70 nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
72 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
74 wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc"
76 echo "Source socket is $src_socket"
78 wait_for_monitor_event $test_node
80 echo "Sleeping until tickles are synchronised across nodes..."
81 try_command_on_node $test_node $CTDB getvar TickleUpdateInterval
82 sleep_for "${out#*= }"
84 if try_command_on_node any "test -r /etc/ctdb/events.d/61.nfstickle" ; then
85 echo "Trying to determine NFS_TICKLE_SHARED_DIRECTORY..."
86 if [ -f /etc/sysconfig/nfs ]; then
87 f="/etc/sysconfig/nfs"
88 elif [ -f /etc/default/nfs ]; then
90 elif [ -f /etc/ctdb/sysconfig/nfs ]; then
91 f="/etc/ctdb/sysconfig/nfs"
93 try_command_on_node -v any "[ -r $f ] && sed -n -e s@^NFS_TICKLE_SHARED_DIRECTORY=@@p $f" || true
95 nfs_tickle_shared_directory="${out:-/gpfs/.ctdb/nfs-tickles}"
97 try_command_on_node $test_node hostname
100 try_command_on_node -v any cat "${nfs_tickle_shared_directory}/$test_hostname/$test_ip"
102 echo "That's OK, we'll use \"ctdb gettickles\", which is newer..."
103 try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port"
106 if [ "${out/${src_socket}/}" != "$out" ] ; then
107 echo "GOOD: NFS connection tracked OK."
109 echo "BAD: Socket not tracked in NFS tickles."
113 tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
115 # We need to be nasty to make that the node being failed out doesn't
116 # get a chance to send any tickles and confuse our sniff.
117 echo "Killing ctdbd on ${test_node}..."
118 try_command_on_node $test_node killall -9 ctdbd
120 wait_until_node_has_status $test_node disconnected
122 tcptickle_sniff_wait_show