6 Verify that a file created on a node is readable via NFS after a failover.
8 We write a file into an exported directory on a node, mount the NFS
9 share from a node, verify that we can read the file via NFS and that
10 we can still read it after a failover.
14 * An active CTDB cluster with at least 2 nodes with public addresses.
16 * Test must be run on a real or virtual cluster rather than against
19 * Test must not be run from a cluster node.
23 1. Verify that the cluster is healthy.
24 2. Select a public address and its corresponding node.
25 3. Select the 1st NFS share exported on the node.
26 4. Write a file into exported directory on the node and calculate its
28 5. Mount the selected NFS share.
29 6. Read the file via the NFS mount and calculate its checksum.
31 8. Disable the selected node.
32 9. Read the file via NFS and calculate its checksum.
33 10. Compare the checksums.
37 * Checksums for the file on all 3 occasions should be the same.
41 . ctdb_test_functions.bash
47 ctdb_test_check_real_cluster
52 ctdb_restart_when_done
54 select_test_node_and_ips
56 first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p')
59 nfs_f="${mnt_d}/$RANDOM"
60 remote_f="${test_ip}:${first_export}/$(basename $nfs_f)"
62 ctdb_test_exit_hook_add rm -f "$local_f"
63 ctdb_test_exit_hook_add rm -f "$nfs_f"
64 ctdb_test_exit_hook_add umount -f "$mnt_d"
65 ctdb_test_exit_hook_add rmdir "$mnt_d"
67 echo "Create file containing random data..."
68 dd if=/dev/urandom of=$local_f bs=1k count=1
69 chmod 644 "$local_f" # needed for *_squash?
70 local_sum=$(sum $local_f)
73 scp -p "$local_f" "$remote_f"
75 echo "Mounting ${test_ip}:${first_export} on ${mnt_d} ..."
76 mount -o timeo=1,hard,intr,vers=3 ${test_ip}:${first_export} ${mnt_d}
80 if [ "$local_sum" = "$nfs_sum" ] ; then
81 echo "GOOD: file contents read correctly via NFS"
83 echo "BAD: file contents are different over NFS"
84 echo " original file: $local_sum"
85 echo " NFS file: $nfs_sum"
91 echo "Disabling node $test_node"
92 try_command_on_node 0 $CTDB disable -n $test_node
93 wait_until_node_has_status $test_node disabled
95 gratarp_sniff_wait_show
100 if [ "$nfs_sum" = "$new_sum" ] ; then
101 echo "GOOD: file contents unchanged after failover"
103 echo "BAD: file contents are different after failover"
104 echo " original file: $nfs_sum"
105 echo " NFS file: $new_sum"