mirror of
https://github.com/ceph/ceph
synced 2024-12-20 10:23:24 +00:00
00651cfac2
1. Deploy 2 gateways on different nodes, then check for multi-path. To add another gateway, only "roles" need to be changed in job yaml. 2. Create "n" nvmeof namespaces, configured by 'namespaces_count' 3. Rename qa/suites/rbd/nvmeof/cluster/fixed-3.yaml to fixed-4.yaml which contains 2 gateways and 2 initiators. Signed-off-by: Vallari Agrawal <val.agl002@gmail.com>
79 lines
1.9 KiB
Bash
Executable File
79 lines
1.9 KiB
Bash
Executable File
#!/bin/bash -x
|
|
|
|
sudo modprobe nvme-fabrics
|
|
sudo modprobe nvme-tcp
|
|
sudo dnf install nvme-cli -y
|
|
sudo lsmod | grep nvme
|
|
|
|
source /etc/ceph/nvmeof.env
|
|
SPDK_CONTROLLER="SPDK bdev Controller"
|
|
DISCOVERY_PORT="8009"
|
|
|
|
discovery() {
|
|
output=$(sudo nvme discover -t tcp -a $NVMEOF_DEFAULT_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_DEFAULT_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_DEFAULT_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 -o '"tcp"' | wc -l)
|
|
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
|
|
gateway_count=$(( $(echo "$NVMEOF_GATEWAY_IP_ADDRESSES" | tr -cd ',' | wc -c) + 1))
|
|
test_run list_subsys $gateway_count
|
|
|
|
|
|
echo "-------------Test Summary-------------"
|
|
echo "[nvmeof] All nvmeof basic tests passed!"
|