diff --git a/tools/create-write-delete-namespaces.sh b/tools/create-write-delete-namespaces.sh index 69d21f5..559e2e0 100755 --- a/tools/create-write-delete-namespaces.sh +++ b/tools/create-write-delete-namespaces.sh @@ -17,61 +17,78 @@ # See the License for the specific language governing permissions and # limitations under the License. +DURATION=${1:-"30s"} +OP=${2:-"randread"} + usage() { cat < (Allocate entire drive) +Usage: $0 [duration: default 30s] [operation: randread|randwrite: default randread] +Examples: + $0 60s randread # random read test for 60 seconds + $0 60m randread # random read test for 60 minutes + $0 300s randwrite # random write test for 300 seconds EOF } -SIZE=${1:-0} +while getopts "h" OPTION +do + case "${OPTION}" in + 'h') + usage + exit 0 + ;; + *) + ;; + esac +done +shift $((OPTIND - 1)) + +SIZE=0 DELAY_FOR_DEVICES=2 -DELAY_TO_COOL_CPU=0 - -case "$SIZE" in - ''|*[!0-9]*) - usage - exit 1 - ;; - *) - # Create and attach a namespace on each drive to the RABBIT's processor - ./nvme.sh create "$SIZE" - ./nvme.sh attach - - printf "Sleeping %d seconds to allow all devices to be available for logical volume\n" "$DELAY_FOR_DEVICES" - sleep "$DELAY_FOR_DEVICES" - - # Create a logical volume spanning all the namespaces - ./lvm.sh create - - # Write a little something to the logical volume to give the drives some work to do on delete-ns operation - fio --direct=1 --rw=randwrite --bs=32M --ioengine=libaio --iodepth=128 --numjobs=4 --runtime=5m --time_based --group_reporting --name=rabbit --eta-newline=1 --filename=/dev/rabbit/rabbit - - if [ $DELAY_TO_COOL_CPU != 0 ] - then - printf "Sleeping %d seconds to cool the CPU\n" "$DELAY_TO_COOL_CPU" - sleep "$DELAY_TO_COOL_CPU" - fi - # Delete the logical volume to tidy up - ./lvm.sh delete - - # Format the namespace to speed up deletion - ./nvme.sh cmd format --force --namspace-id=1 - - # Wait for the format to finish - areWeDone=$(nvme list | grep KIO | awk '{if ($6 > 0) { print "wait" } else { print "done" }}') - while [ "$areWeDone" != "done" ]; do - sleep 1 - printf "Formatting, space left %f\n" "$(nvme list | grep KIO | awk '{print $6}')" - areWeDone=$(nvme list | grep KIO | awk '{if ($6 > 0) { print "wait" } else { print "done" }}') - done - - # Show the nvme namespaces for the record - nvme list | grep KIO - - # Finally, delete the namespaces - ./nvme.sh -t delete - ;; -esac + +printf "duration %s\n" $DURATION +printf "operation %s\n" $OP + +# Ensure lvm.conf doesn't get in the way +sed -i 's/use_lvmlockd = 1/use_lvmlockd = 0/g' /etc/lvm/lvm.conf + +# Ensure the /dev/rabbit directory doesn't already exist +rm -rf /dev/rabbit + +# Run nnf-ec just to be sure +./nnf-ec + +# Create and attach a namespace on each drive to the RABBIT's processor +./nvme.sh create "$SIZE" +./nvme.sh attach + +printf "Sleeping %d seconds to allow all devices to be available for logical volume\n" "$DELAY_FOR_DEVICES" +sleep "$DELAY_FOR_DEVICES" + +# Create a logical volume spanning all the namespaces +./lvm.sh create + +# Write a little something to the logical volume to give the drives some work to do on delete-ns operation +fio --direct=1 --rw="$OP" --bs=32M --ioengine=libaio --iodepth=128 --numjobs=4 --runtime="$DURATION" --time_based --group_reporting --name=rabbit --eta-newline=1 --filename=/dev/rabbit/rabbit + +# Delete the logical volume to tidy up +./lvm.sh delete + +# Format the namespace to speed up deletion +./nvme.sh cmd format --force --namespace-id=1 + +# Wait for the format to finish +gbToFormat=$(nvme list | grep KIO | awk '{print $6}' | tr ' ' '\n' | paste -sd+ - | bc | awk '{print ($1 == int($1)) ? int($1) : int($1) + 1}') +while (("$gbToFormat" > 0)); do + sleep 1 + printf "Formatting, space left %d\n" "$(nvme list | grep KIO | awk '{print $6}' | tr ' ' '\n' | paste -sd+ - | bc | awk '{print ($1 == int($1)) ? $1 : int($1) + 1}')" + gbToFormat=$(nvme list | grep KIO | awk '{print $6}' | tr ' ' '\n' | paste -sd+ - | bc | awk '{print ($1 == int($1)) ? int($1) : int($1) + 1}') +done + +# Show the nvme namespaces for the record +nvme list | grep KIO + +# Finally, delete the namespaces +./nvme.sh -t delete diff --git a/tools/rabbit-s.sh b/tools/rabbit-s.sh index 3d5dbb5..c15ff6b 100755 --- a/tools/rabbit-s.sh +++ b/tools/rabbit-s.sh @@ -178,6 +178,21 @@ EOF $SSHPASS ssh root@$SYSTEM <<-EOF screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s fio\nfabdbg -s gfms\nlog -m 0x81 -s 5\nlog -m 0x81 -s 5 -p on\nlog -m 0x82 -s 5\nlog -m 0x82 -s 5 -p on\nlog -m 0x84 -s 5\nlog -m 0x84 -s 5 -p on\nlog -m 0x54 -s 5\nlog -m 0x54 -s 5 -p on\n" +EOF + done + ;; + hpecray-23) + for SESSION in "${SESSIONS[@]}" + do + + # For this run, we want to enable some logging settings that we have been leaving off for a while. + # FABIOV - 0x82 + # log -m 0x82 -s 3 + # log -m 0x82 -s 3 -p on + # fabdbg -s fio + # fabdbg -s gfms + $SSHPASS ssh root@$SYSTEM <<-EOF + screen -S $SESSION -X stuff "log -m 0x82 -s 3\nlog -m 0x82 -s 3 -p on\nlog -m 0x84 -s 3\nlog -m 0x84 -s 3 -p on\nfabdbg -s gfms\nfabdbg -c rule" EOF done ;; diff --git a/tools/switch.sh b/tools/switch.sh index 4256d2a..5b53a5b 100755 --- a/tools/switch.sh +++ b/tools/switch.sh @@ -37,6 +37,7 @@ Commands: info display switch hardware information ep-tunnel-status display endpoint tunnel status for each drive ep-tunnel-enable enable the endpoint tunnel for each drive + ep-tunnel-disable disable the endpoint tunnel for each drive fabric [COMMAND] [ARG [ARG]...] execute the fabric COMMAND (default is gfms-dump) cmd [COMMAND] [ARG [ARG]...] execute COMMAND on each switchtec device in the system. @@ -97,9 +98,9 @@ getChassis() { COMMAND=xhost-query.py if command -v $COMMAND &> /dev/null; then - CHASSIS=$("$COMMAND" $(hostname) | cut -c -7) + CHASSIS=$("$COMMAND" "$(hostname)" | cut -c -7) else - CHASSIS="x****c*" + CHASSIS=$(hostname | cut -c -8) fi } @@ -411,6 +412,13 @@ case $1 in } execute ep-tunnel-enable ;; + ep-tunnel-disable) + function ep-tunnel-disable() { + local SWITCH=$1 + ep-tunnel-command "$SWITCH" "disable" + } + execute ep-tunnel-disable + ;; fabric) function fabric() { local SWITCH=$1 FABRIC_CMD=$2 ARGS=( "${@:3}" )