Skip to content

Commit

Permalink
Cleanup shellcheck errors
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Floeder <[email protected]>
  • Loading branch information
ajfloeder committed Dec 5, 2024
1 parent d73bda0 commit cb5a69a
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 154 deletions.
49 changes: 0 additions & 49 deletions tools/_util.sh

This file was deleted.

5 changes: 3 additions & 2 deletions tools/create-write-delete-namespaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail

DURATION=${1:-"30s"}
OP=${2:-"randread"}
Expand Down Expand Up @@ -48,8 +49,8 @@ shift $((OPTIND - 1))
SIZE=0
DELAY_FOR_DEVICES=2

printf "duration %s\n" $DURATION
printf "operation %s\n" $OP
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
Expand Down
61 changes: 0 additions & 61 deletions tools/devices.sh

This file was deleted.

39 changes: 33 additions & 6 deletions tools/nvme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail
shopt -s expand_aliases

# Pull in common utility functions
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# shellcheck source="$SCRIPT_DIR"/_util.sh
source "$SCRIPT_DIR"/_util.sh

usage() {
cat <<EOF
Run various NVMe Namespace commands over the NVMe switch fabric using
Expand Down Expand Up @@ -122,6 +117,38 @@ executeParallel() {
rm _result*
}

# Retrieve the Physical Device Fabric IDs used to iterate through a list of nvme drives
function getPDFIDs() {
local SWITCH=$1 FUNCTION="${2:-0}"

switchtec fabric gfms-dump "$SWITCH" | grep "Function $FUNCTION " -A2 | grep PDFID | awk '{print $2}'
}

function getDriveList() {
# DRIVES=$1
# for DRIVE in $(ls /dev/nvme* | grep -E "nvme[[:digit:]]+$");
for DRIVE in /dev/nvme[0-9]*;
do
# shellcheck disable=SC2086
if [ "$(nvme id-ctrl ${DRIVE} | grep -e KIOXIA -e 'SAMSUNG MZ3LO1T9HCJR')" != "" ];
then
# SerialNumber=$(nvme id-ctrl ${DRIVE} | grep -E "^sn " | awk '{print $3}')
# Mfg=$(nvme id-ctrl ${DRIVE} | grep -E "^mn " | awk '{print $3}')
# FW=$(nvme id-ctrl ${DRIVE} | grep -E "^fr " | awk '{print $3}')
# printf "%s\t%s\t%s\t%s\n" "$DRIVE" "$Mfg" "$SerialNumber" "$FW"

DRIVES+=("${DRIVE}")
fi
done

DriveCount="${#DRIVES[@]}"
if ((DriveCount == 0));
then
printf "No drives found: Did you run nnf-ec?\n"
fi
}


alias TIME=""
while getopts "th:" OPTION
do
Expand Down
32 changes: 16 additions & 16 deletions tools/rabbit-s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ case $CMD in
declare -a DEVICES=("pax0 /dev/ttyS9" "pax1 /dev/ttyS11")
for DEVICE in "${DEVICES[@]}"
do
PAX=$(echo $DEVICE | cut -d' ' -f1)
PAX=$(echo "$DEVICE" | cut -d' ' -f1)

echo "Enabling Logging on $PAX"
$SSHPASS ssh -T root@$SYSTEM <<-EOF
$SSHPASS ssh -T root@"$SYSTEM" <<-EOF
if ! screen -list | grep -q "$PAX"; then
screen -dmS $DEVICE 230400 &&
screen -S $PAX -X colon "logfile $PAX.log^M" &&
Expand All @@ -96,56 +96,56 @@ EOF
clear-logs)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM "> $SESSION.log"
$SSHPASS ssh root@"$SYSTEM" "> $SESSION.log"
done
;;
get-logs)
$SSHPASS scp root@$SYSTEM:~/*.log ./
$SSHPASS scp root@"$SYSTEM":~/*.log ./
;;
fabdbg-on)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "fabdbg -s info\nfabdbg -s pax\nfabdbg -s gfms\nfabdbg -s hvm\nfabdbg -s sfm\nfabdbg -s fio\nfabdbg -s rule\n"
EOF
done
;;
fabdbg-off)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "fabdbg -c info\nfabdbg -c pax\nfabdbg -c gfms\nfabdbg -c hvm\nfabdbg -c sfm\nfabdbg -c fio\nfabdbg -c rule\n"
EOF
done
;;
additional-logs)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "log -t on\nlog -m 0x82 -s3\nlog -m 0x84 -s3\nlog -m 0x82 -s3 -p on\nlog -m 0x84 -s3 -p on\n"
EOF
done
;;
additional-logs-off)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "log -p off\nlog -m 0x84 -s3 -p off\nlog -m 0x82 -s3 -p off\nlog -m 0x84 -s3 -p off\n"
EOF
done
;;
slow-drive-logs)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s gfms\nfabdbg -s hvm\nfabdbg -s sfm\nlog -m 0x84 -s 3 -p on -t on\nlog -m 0x82 -s 3 -p on -t on\n"
EOF
done
;;
switch-hang-logs)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
# screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s gfms\nfabdbg -s hvm\nfabdbg -s sfm\nlog -m 0x84 -s 3 -p on -t on\nlog -m 0x82 -s 3 -p on -t on\n"
# New and improved settings based on https://customer-jira.microchip.com/browse/HPECRAY-23
Expand Down Expand Up @@ -176,7 +176,7 @@ EOF
# > fabdbg -s fio
# > fabdbg -s gfms

$SSHPASS ssh root@$SYSTEM <<-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
Expand All @@ -191,7 +191,7 @@ EOF
# log -m 0x82 -s 3 -p on
# fabdbg -s fio
# fabdbg -s gfms
$SSHPASS ssh root@$SYSTEM <<-EOF
$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
Expand All @@ -211,7 +211,7 @@ EOF
# fabdbg -s fio
# fabdbg -s gfms

$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s fio\nfabdbg -s gfms\nlog -m 0x82 -s 3\nlog -m 0x82 -s 3 -p on\nlog -m 0x53 -s 3\nlog -m 0x53 -s 3 -p on\n"
EOF
done
Expand All @@ -230,7 +230,7 @@ EOF

# Turn on the logging for all modules
# log -p on
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s fio\nfabdbg -s gfms\nlog -m 0x54 -s 3\nlog -m 0x54 -s 3 -p on\nlog -p on\n"
EOF
done
Expand All @@ -239,13 +239,13 @@ EOF
quit-sessions)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh -T root@$SYSTEM "screen -S $SESSION -X quit"
$SSHPASS ssh -T root@"$SYSTEM" "screen -S $SESSION -X quit"
done
;;
lnkstat)
for SESSION in "${SESSIONS[@]}"
do
$SSHPASS ssh root@$SYSTEM <<-EOF
$SSHPASS ssh root@"$SYSTEM" <<-EOF
screen -S $SESSION -X colon "wrap off^M" &&
screen -S $SESSION -X stuff "lnkstat\\n" &&
sleep 1 &&
Expand Down
Loading

0 comments on commit cb5a69a

Please sign in to comment.