Skip to content

Commit 22f91cd

Browse files
committed
qa/workunits/nvmeof/basic_tests.sh: fix connect-all assert
There seems to be change in 'nvme list' json output which caused failures in asserts after 'nvme connect-all' command. Signed-off-by: Vallari Agrawal <vallari.agrawal@ibm.com>
1 parent 7fb301b commit 22f91cd

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

qa/tasks/nvmeof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def __init__(self, ctx, config, daemons) -> None:
315315

316316
def _get_devices(self, remote):
317317
GET_DEVICE_CMD = "sudo nvme list --output-format=json | " \
318-
"jq -r '.Devices | sort_by(.NameSpace) | .[] | select(.ModelNumber == \"Ceph bdev Controller\") | .DevicePath'"
318+
"jq -r '.Devices[].Subsystems[] | select(.Controllers | all(.ModelNumber == \"Ceph bdev Controller\")) | .Namespaces | sort_by(.NSID) | .[] | .NameSpace'"
319319
devices = remote.sh(GET_DEVICE_CMD).split()
320320
return devices
321321

qa/workunits/nvmeof/basic_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ connect_all() {
3939
sudo nvme connect-all --traddr=$NVMEOF_DEFAULT_GATEWAY_IP_ADDRESS --transport=tcp -l 3600
4040
sleep 5
4141
expected_devices_count=$1
42-
actual_devices=$(sudo nvme list --output-format=json | grep -o "$SPDK_CONTROLLER" | wc -l)
42+
actual_devices=$(sudo nvme list --output-format=json | jq -r ".Devices[].Subsystems[] | select(.Controllers | all(.ModelNumber == \"$SPDK_CONTROLLER\")) | .Namespaces[].NameSpace" | wc -l)
4343
if [ "$actual_devices" -ne "$expected_devices_count" ]; then
4444
sudo nvme list --output-format=json
4545
return 1
@@ -74,7 +74,7 @@ test_run connect
7474
test_run list_subsys 1
7575
test_run disconnect_all
7676
test_run list_subsys 0
77-
devices_count=$(( $NVMEOF_NAMESPACES_COUNT * $NVMEOF_SUBSYSTEMS_COUNT))
77+
devices_count=$(( $NVMEOF_NAMESPACES_COUNT * $NVMEOF_SUBSYSTEMS_COUNT ))
7878
test_run connect_all $devices_count
7979
gateways_count=$(( $(echo "$NVMEOF_GATEWAY_IP_ADDRESSES" | tr -cd ',' | wc -c) + 1 ))
8080
multipath_count=$(( $gateways_count * $NVMEOF_SUBSYSTEMS_COUNT))

qa/workunits/nvmeof/fio_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434

3535
fio_file=$(mktemp -t nvmeof-fio-XXXX)
3636
all_drives_list=$(sudo nvme list --output-format=json |
37-
jq -r '.Devices | sort_by(.NameSpace) | .[] | select(.ModelNumber == "Ceph bdev Controller") | .DevicePath')
37+
jq -r '.Devices[].Subsystems[] | select(.Controllers | all(.ModelNumber == "Ceph bdev Controller")) | .Namespaces | sort_by(.NSID) | .[] | .NameSpace')
3838

3939
# When the script is passed --start_ns and --end_ns (example: `nvmeof_fio_test.sh --start_ns 1 --end_ns 3`),
4040
# then fio runs on namespaces only in the defined range (which is 1 to 3 here).

0 commit comments

Comments
 (0)