@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1
local nvmedev
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "blktests-subsystem-1")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1
local nvmedev
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "blktests-subsystem-1")
udevadm settle
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -33,7 +33,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -35,7 +35,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -40,7 +40,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -35,7 +35,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -39,7 +39,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -35,7 +35,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -37,7 +37,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -34,7 +34,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -70,7 +70,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${subsys_name}"
- nvmedev="$(_find_nvme_dev)"
+ nvmedev=$(_find_nvme_dev "${subsys_name}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
@@ -273,12 +273,13 @@ _remove_nvmet_subsystem_from_port() {
}
_find_nvme_dev() {
+ local subsys=$1
+ local subsysnqn
local dev
- local transport
for dev in /sys/class/nvme/nvme*; do
dev="$(basename "$dev")"
- transport="$(cat "/sys/class/nvme/${dev}/transport")"
- if [[ "$transport" == "${nvme_trtype}" ]]; then
+ subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn")"
+ if [[ "$subsysnqn" == "$subsys" ]]; then
echo "$dev"
for ((i = 0; i < 10; i++)); do
if [[ -e /sys/block/$dev/uuid &&
This ensures we find the correct nvme loop device if others exist on a given system (which is generally not expected on test systems). Additionally, this will be required in the upcomming test nvme/037 which will have controllers racing with ones being destroyed. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/008 | 2 +- tests/nvme/009 | 2 +- tests/nvme/010 | 2 +- tests/nvme/011 | 2 +- tests/nvme/012 | 2 +- tests/nvme/013 | 2 +- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/018 | 2 +- tests/nvme/019 | 2 +- tests/nvme/020 | 2 +- tests/nvme/021 | 2 +- tests/nvme/022 | 2 +- tests/nvme/023 | 2 +- tests/nvme/024 | 2 +- tests/nvme/025 | 2 +- tests/nvme/026 | 2 +- tests/nvme/027 | 2 +- tests/nvme/028 | 2 +- tests/nvme/029 | 2 +- tests/nvme/rc | 7 ++++--- 23 files changed, 26 insertions(+), 25 deletions(-)