Skip to content

Commit

Permalink
Update switch.sh to provide more details. (#113)
Browse files Browse the repository at this point in the history
* Add HPECRAY-23 log settings for PAXs

Signed-off-by: Anthony Floeder <[email protected]>

* switch.sh: Add device and PAX ID info to all commands and support a VERBOSE option
switch.sh: Add PCI info to the status command.
switch.sh: Don't display slots 1 and 13

Signed-off-by: Anthony Floeder <[email protected]>

---------

Signed-off-by: Anthony Floeder <[email protected]>
  • Loading branch information
ajfloeder authored Dec 5, 2024
1 parent afc4d0c commit 51a5364
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 267 deletions.
49 changes: 0 additions & 49 deletions tools/_util.sh

This file was deleted.

120 changes: 69 additions & 51 deletions tools/create-write-delete-namespaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,80 @@
# 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"}

usage() {
cat <<EOF
Create a namespace on every drive, create a logical volume from those namespaces, write the logical volume, then delete everything
Usage: $0 [NAMESPACE-SIZE-IN-BYTES]
Create a namespace on every drive, create a logical volume from those namespaces, operate over that logical volume, then delete everything
NAMESPACE-SIZE-IN-BYTES: 0 -> (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
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
Loading

0 comments on commit 51a5364

Please sign in to comment.