If fence_scsi_test attempts to create a reservation and fails, the error counter is set to zero. This is clearly a bug. The easiest was to see this bug is to use fence_scsi_test on a device that clearly does no support SCSI-PR. Use the "on" action, any key, and be sure to use the verbose flag: # fence_scsi_test -o on -k 123 -d /dev/sda -v main::do_key_write (key=123) main::get_devices main::print_devices /dev/sda main::get_devices_name (dev=/dev/sda) name=/dev/sda main::get_devices_path (dev=/dev/sda) path=[ /dev/sda ] main::do_action_on (dev=/dev/sda node_key=123) main::do_reset (dev=/dev/sda) cmd=sg_turs /dev/sda err=0 main::do_register_ignore (dev=/dev/sda sark=123) cmd=sg_persist -n -o -I -S 123 -d /dev/sda err=9 main::get_keys_reserve (dev=/dev/sda) cmd=sg_persist -n -i -r -d /dev/sda err=9 keys=[ ] main::do_reserve (dev=/dev/sda rk=123) cmd=sg_persist -n -o -R -T 5 -K 123 -d /dev/sda err=9 main::do_verify_on (dev=/dev/sda node_key=123) main::get_keys_register (dev=/dev/sda) cmd=sg_persist -n -i -k -d /dev/sda err=9 keys=[ ] main::get_keys_reserve (dev=/dev/sda) cmd=sg_persist -n -i -r -d /dev/sda err=9 keys=[ ] main::print_results (dev=/dev/sda) results=[ action=0 verify=2 ] We can see that do_register_ignore and do_reserve both failed with err=9. This should be reflected in the results printed at the end of the script. In this case, we see the results are "[ action=0 verify=2 ]". This means there were no errors during registration/reservation creation. We should see "[ action=2 verify=2 ]".
Created attachment 574879 [details] Increment error count when reservation fails. Don't reset the error count to zero if do_reserve fails. Instead, increment the error count. This fix will correctly report errors during the "action" portion of the test.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux release for currently deployed products. This request is not yet committed for inclusion in a release.
Here is the same test with the patch: # fence_scsi_test.pl -o on -k 123 -d /dev/sda -v main::do_key_write (key=123) main::get_devices main::print_devices /dev/sda main::get_devices_name (dev=/dev/sda) name=/dev/sda main::get_devices_path (dev=/dev/sda) path=[ /dev/sda ] main::get_keys_register (dev=/dev/sda) cmd=sg_persist -n -i -k -d /dev/sda err=9 keys=[ ] main::do_action_on (dev=/dev/sda node_key=123) main::do_reset (dev=/dev/sda) cmd=sg_turs /dev/sda err=0 main::do_register_ignore (dev=/dev/sda sark=123) cmd=sg_persist -n -o -I -S 123 -d /dev/sda err=9 main::get_keys_reserve (dev=/dev/sda) cmd=sg_persist -n -i -r -d /dev/sda err=9 keys=[ ] main::do_reserve (dev=/dev/sda rk=123) cmd=sg_persist -n -o -R -T 5 -K 123 -d /dev/sda err=9 main::do_verify_on (dev=/dev/sda node_key=123) main::get_keys_register (dev=/dev/sda) cmd=sg_persist -n -i -k -d /dev/sda err=9 keys=[ ] main::get_keys_reserve (dev=/dev/sda) cmd=sg_persist -n -i -r -d /dev/sda err=9 keys=[ ] main::print_results (dev=/dev/sda) results=[ action=2 verify=2 ] This test attempts to create a registration and reservation on /dev/sda, which does not support SCSI-PR. Both do_register_ignore and do_reserve fail as expected. Note that the results are now correct.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0076.html