Files
scst/scripts/runtime/test-persistent-reservation
Gleb Chesnokov 13839f3f6a scripts: Group runtime diagnostics and exercisers under runtime/
Place interrupt and memory monitors beside the block-device benchmark and
persistent-reservation exerciser. Update the SRPT maintainer instructions
and copyright paths with the move.

The four helpers are byte-for-byte unchanged, including their existing
privilege requirements and device or host side effects.
2026-10-19 10:31:32 +03:00

42 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
if [ $# != 1 ]; then
echo "Error: wrong number of arguments (expecting one)."
exit 1
fi
KEY1=ABC123
KEY2=BAD123
DEV="$1"
persist="-Z"
# Use sg_persist to put SCSI Persistent Reservation thru its paces.
echo -e "\n>>>> Query registered keys - Should report 'no keys'"
sg_persist --no-inquiry -i --read-keys "$DEV"
echo -e "\n>>>> Registering key $KEY1"
sg_persist -n -o $persist --register --param-sark $KEY1 "$DEV"
echo -e "\n>>>> Query registered keys - Should report 'key' $KEY1"
sg_persist -n -i --read-keys "$DEV"
echo -e "\n>>>> Replacing registered key $KEY1 with $KEY2"
sg_persist -n -o $persist --register --param-sark $KEY2 --param-rk $KEY1 "$DEV"
echo -e "\n>>>> Query registered keys - Should report 'key' $KEY2"
sg_persist -n -i --read-keys "$DEV"
echo -e "\n>>>> Reserving device using key $KEY2 (Write exclusive)"
sg_persist -n -o $persist --reserve --prout-type=1 --param-rk $KEY2 "$DEV"
echo -e "\n>>>> Removing registered key 'bad123' "
sg_persist -n -o $persist --register --param-sark 0 --param-rk $KEY2 "$DEV"
echo -e "\n>>>> Query registered keys - Should report no registered keys"
sg_persist -n -i --read-keys "$DEV"
echo -e "\n>>>> Query full status - Should neither report key $KEY1 nor key $KEY2"
sg_persist -n -i --read-full-status "$DEV"