| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Verify that NFS connections are monitored and that NFS tickles are sent. |
| 4 | |
| 5 | # Create a connection to the NFS server on a node. Then disable the |
| 6 | # relevant NFS server node and ensure that it sends an appropriate reset |
| 7 | # packet. The packet must come from the releasing node. |
| 8 | |
| 9 | # Prerequisites: |
| 10 | |
| 11 | # * An active CTDB cluster with at least 2 nodes with public addresses. |
| 12 | |
| 13 | # * Test must be run on a real or virtual cluster rather than against |
| 14 | # local daemons. |
| 15 | |
| 16 | # * Test must not be run from a cluster node. |
| 17 | |
| 18 | # * Cluster nodes must be listening on the NFS TCP port (2049). |
| 19 | |
| 20 | # Expected results: |
| 21 | |
| 22 | # * CTDB on the releasing node should correctly send a reset packet when |
| 23 | # the node is disabled. |
| 24 | |
| 25 | . "${TEST_SCRIPTS_DIR}/cluster.bash" |
| 26 | |
| 27 | set -e |
| 28 | |
| 29 | ctdb_test_init |
| 30 | |
| 31 | select_test_node_and_ips |
| 32 | |
| 33 | test_port=2049 |
| 34 | |
| 35 | echoscip-shell system . . echo. "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..." |
| 36 | |
| 37 | sleepscip-shell system . . sleep. 30 | nc $test_ip $test_port & |
| 38 | nc_pid=$! |
| 39 | ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1" |
| 40 | |
| 41 | wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc" |
| 42 | src_socket="$out" |
| 43 | echoscip-shell system . . echo. "Source socket is $src_socket" |
| 44 | |
| 45 | echoscip-shell system . . echo. "Getting MAC address associated with ${test_ip}..." |
| 46 | releasing_mac=$(ip neigh show $test_prefix | awkscip-shell system . . awk. '$4 == "lladdr" {print $5}') |
| 47 | [scip-shell system . . `[`. -n "$releasing_mac" ] || die "Couldn't get MAC address for ${test_prefix}" |
| 48 | echoscip-shell system . . echo. "MAC address is: ${releasing_mac}" |
| 49 | |
| 50 | tcptickle_sniff_start $src_socket "${test_ip}:${test_port}" |
| 51 | |
| 52 | echoscip-shell system . . echo. "Disabling node $test_node" |
| 53 | try_command_on_node 1 $CTDB disable -n $test_node |
| 54 | wait_until_node_has_status $test_node disabled |
| 55 | |
| 56 | # Only look for a reset from the releasing node |
| 57 | tcptickle_sniff_wait_show "$releasing_mac" |