2009-06-16 06:47:59 +04:00
#!/bin/bash
test_info( )
{
cat <<EOF
Verify that CIFS connections are monitored and that CIFS tickles are sent.
We create a connection to the CIFS server on a node and confirm that
this connection is registered by CTDB. Then disable the relevant CIFS
2016-03-08 01:59:33 +03:00
server node and ensure that the takeover node sends an appropriate
reset packet.
2009-06-16 06:47:59 +04:00
Prerequisites:
* An active CTDB cluster with at least 2 nodes with public addresses.
* Test must be run on a real or virtual cluster rather than against
local daemons.
* Test must not be run from a cluster node.
* Clustered Samba must be listening on TCP port 445.
Expected results:
2016-03-08 01:59:33 +03:00
* CTDB should correctly record the connection and the takeover node
should send a reset packet.
2009-06-16 06:47:59 +04:00
EOF
}
2012-04-18 08:55:21 +04:00
. " ${ TEST_SCRIPTS_DIR } /integration.bash "
2009-06-16 06:47:59 +04:00
set -e
2018-10-08 07:04:24 +03:00
ctdb_test_init
2009-06-16 06:47:59 +04:00
ctdb_test_check_real_cluster
2009-07-06 11:52:11 +04:00
cluster_is_healthy
2009-06-16 06:47:59 +04:00
# We need this for later, so we know how long to sleep.
try_command_on_node 0 $CTDB getvar MonitorInterval
monitor_interval = " ${ out #*= } "
#echo "Monitor interval on node $test_node is $monitor_interval seconds."
2009-07-08 07:37:52 +04:00
select_test_node_and_ips
2009-06-16 06:47:59 +04:00
test_port = 445
echo " Connecting to node ${ test_node } on IP ${ test_ip } : ${ test_port } with netcat... "
2018-03-08 03:49:56 +03:00
sleep $(( monitor_interval * 4 )) | nc $test_ip $test_port &
2009-06-16 06:47:59 +04:00
nc_pid = $!
ctdb_test_exit_hook_add " kill $nc_pid >/dev/null 2>&1 "
wait_until_get_src_socket "tcp" " ${ test_ip } : ${ test_port } " $nc_pid "nc"
src_socket = " $out "
echo " Source socket is $src_socket "
2009-11-13 01:44:34 +03:00
# This should happen as soon as connection is up... but unless we wait
# we sometimes beat the registration.
2016-03-08 01:59:33 +03:00
echo "Checking if CIFS connection is tracked by CTDB on test node..."
2014-02-28 08:54:05 +04:00
wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
2009-06-16 06:47:59 +04:00
2016-03-08 01:59:33 +03:00
# This is almost immediate. However, it is sent between nodes
# asynchonously, so it is worth checking...
echo "Wait until CIFS connection is tracked by CTDB on all nodes..."
try_command_on_node $test_node " $CTDB listnodes | wc -l "
numnodes = " $out "
wait_until 5 \
check_tickles_all $numnodes $test_ip $test_port $src_socket
2009-07-03 14:44:55 +04:00
tcptickle_sniff_start $src_socket " ${ test_ip } : ${ test_port } "
2009-06-16 06:47:59 +04:00
2009-08-27 06:35:52 +04:00
echo " Disabling node $test_node "
2009-06-16 06:47:59 +04:00
try_command_on_node 1 $CTDB disable -n $test_node
2009-09-11 10:15:31 +04:00
wait_until_node_has_status $test_node disabled
2009-06-16 06:47:59 +04:00
2009-07-03 14:44:55 +04:00
tcptickle_sniff_wait_show