ceph/qa/workunits/rbd/nvmeof_basic_tests.sh
Vallari Agrawal 1713c4852c
qa: add qa/tasks/nvmeof.py and rbd/nvmeof_basic_task and fio workunits
This is v2 of the rbd/nvmeof test: It deploys 1 gateway and 1 initiator.
Then does basic verification on nvme commands and runs fio.

This commit creates:
1. qa/tasks/nvmeof.py: adds a new 'Nvmeof' task which deploys
    the gateway and shares config with the initiator hosts.
    Sharing config was previously done by 'nvmeof_gateway_cfg' task
    in qa/tasks/cephadm.py (that task is removed in this commit).
2. qa/workunits/rbd/nvmeof_basic_tests.sh:
    Runs nvme commands (discovery, connect, connect-all, disconnect-all,
    and list-subsys) and does basic verification of the output.
3. qa/workunits/rbd/nvmeof_fio_test.sh:
    Runs fio command. Also runs iostat in parallel if IOSTAT_INTERVAL
    variable is set. This variable configures the delay between each iostat
    print.

nvmeof-cli upgrade from v0.0.6 to v0.0.7 introduced major changes
to all nvmeof commands. This commit changes v0.0.6 commands to
v0.0.7 in qa/workunits/rbd/nvmeof_initiator.sh

Signed-off-by: Vallari Agrawal <val.agl002@gmail.com>
2024-02-12 13:00:09 +05:30

73 lines
1.6 KiB
Bash
Executable File

#!/bin/bash -x
source /etc/ceph/nvmeof.env
SPDK_CONTROLLER="SPDK bdev Controller"
DISCOVERY_PORT="8009"
discovery() {
output=$(sudo nvme discover -t tcp -a $NVMEOF_GATEWAY_IP_ADDRESS -s $DISCOVERY_PORT)
expected_discovery_stdout="subtype: nvme subsystem"
if ! echo "$output" | grep -q "$expected_discovery_stdout"; then
return 1
fi
}
connect() {
sudo nvme connect -t tcp --traddr $NVMEOF_GATEWAY_IP_ADDRESS -s $NVMEOF_PORT -n $NVMEOF_NQN
output=$(sudo nvme list)
if ! echo "$output" | grep -q "$SPDK_CONTROLLER"; then
return 1
fi
}
disconnect_all() {
sudo nvme disconnect-all
output=$(sudo nvme list)
if echo "$output" | grep -q "$SPDK_CONTROLLER"; then
return 1
fi
}
connect_all() {
sudo nvme connect-all --traddr=$NVMEOF_GATEWAY_IP_ADDRESS --transport=tcp
output=$(sudo nvme list)
if ! echo "$output" | grep -q "$SPDK_CONTROLLER"; then
return 1
fi
}
list_subsys() {
expected_count=$1
output=$(sudo nvme list-subsys --output-format=json)
multipath=$(echo $output | grep -c '"tcp"')
if [ "$multipath" -ne "$expected_count" ]; then
return 1
fi
}
test_run() {
echo "[nvmeof] Running test: $1"
$1 "${@:2}" # execute func
if [ $? -eq 0 ]; then
echo "[nvmeof] $1 test passed!"
else
echo "[nvmeof] $1 test failed!"
exit 1
fi
}
test_run disconnect_all
test_run discovery
test_run connect
test_run list_subsys 1
test_run disconnect_all
test_run list_subsys 0
test_run connect_all
test_run list_subsys 1
echo "-------------Test Summary-------------"
echo "[nvmeof] All nvmeof basic tests passed!"