Skip to content

Commit

Permalink
nvme: do not print UUID to log files
Browse files Browse the repository at this point in the history
The UUID/wwid of a namespace might be assigned externally, so
we shouldn't register it in the 'out' files.
The current checks for UUID/wwid are just there to ensure that
if a UUID is present is should match the wwid setting.
So rather add a function _check_uuid() which does exactly that
and don't register the actual UUID in the 'out' files.

[Shin'ichiro: added check against def_subsys_uuid in _check_uuid()]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
  • Loading branch information
hreinecke authored and kawasaki committed Nov 24, 2023
1 parent a046a7c commit ce61317
Show file tree
Hide file tree
Showing 43 changed files with 45 additions and 84 deletions.
3 changes: 1 addition & 2 deletions tests/nvme/004
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ test() {

local nvmedev
nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_nvme_disconnect_subsys ${def_subsysnqn}

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/004.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/004
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/008
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_nvme_disconnect_subsys "${def_subsysnqn}"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/008.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/008
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/009
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_nvme_disconnect_subsys "${def_subsysnqn}"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/009.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/009
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/010
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_run_fio_verify_io --size="${nvme_img_size}" \
--filename="/dev/${nvmedev}n1"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/010.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/010
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/011
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_run_fio_verify_io --size="${nvme_img_size}" \
--filename="/dev/${nvmedev}n1"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/011.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/011
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/012
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_xfs_run_fio_verify_io "/dev/${nvmedev}n1"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/012.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/012
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/013
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

_xfs_run_fio_verify_io "/dev/${nvmedev}n1"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/013.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/013
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/014
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/014.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Running nvme/014
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NVMe Flush: success
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/015
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

size="$(blockdev --getsize64 "/dev/${nvmedev}n1")"
bs="$(blockdev --getbsz "/dev/${nvmedev}n1")"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/015.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Running nvme/015
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NVMe Flush: success
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/018
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

local sectors
local bs
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/018.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Running nvme/018
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/019
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/019.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Running nvme/019
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NVMe DSM: success
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/020
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}"

Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/020.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Running nvme/020
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
NVMe DSM: success
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/021
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme list 2>> "$FULL" | grep -q "${nvmedev}n1"; then
echo "ERROR: device not listed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/021.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/021
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/022
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme reset "/dev/${nvmedev}" >> "$FULL" 2>&1; then
echo "ERROR: reset failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/022.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/022
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/023
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then
echo "ERROR: smart-log bdev-ns failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/023.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/023
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/024
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then
echo "ERROR: smart-log file-ns failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/024.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/024
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/025
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme effects-log "/dev/${nvmedev}" >> "$FULL" 2>&1; then
echo "ERROR: effects-log failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/025.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/025
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/026
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme ns-descs "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then
echo "ERROR: ns-desc failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/026.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/026
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/027
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme ns-rescan "/dev/${nvmedev}" >> "$FULL" 2>&1; then
echo "ERROR: ns-rescan failed"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/027.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/027
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/028
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

if ! nvme list-subsys 2>> "$FULL" | grep -q "${nvme_trtype}"; then
echo "ERROR: list-subsys"
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/028.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/028
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
3 changes: 1 addition & 2 deletions tests/nvme/029
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ test() {
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"

nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
cat "/sys/block/${nvmedev}n1/uuid"
cat "/sys/block/${nvmedev}n1/wwid"
_check_uuid "${nvmedev}"

local dev="/dev/${nvmedev}n1"
test_user_io "$dev" 1 512 > "$FULL" 2>&1 || echo FAIL
Expand Down
2 changes: 0 additions & 2 deletions tests/nvme/029.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Running nvme/029
91fdba0d-f87b-4c25-b80f-db7be1418b9e
uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
Test complete
24 changes: 24 additions & 0 deletions tests/nvme/rc
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,30 @@ _check_genctr() {
echo "${genctr}"
}

_check_uuid() {
local nvmedev=$1
local nr_nsid=0

for ns in "/sys/block/${nvmedev}n"* ; do
[ -e "${ns}/wwid" ] || continue
nr_nsid=$((nr_nsid + 1))
[ -e "${ns}/uuid" ] || continue
uuid=$(cat "${ns}/uuid")
wwid=$(cat "${ns}/wwid")
if [ "${uuid}" != "${wwid#uuid.}" ]; then
echo "UUID ${uuid} mismatch (wwid ${wwid})"
return 1
elif [ "${uuid}" != "${def_subsys_uuid}" ]; then
echo "UUID ${uuid} mismatch with ${def_subsys_uuid})"
return 1
fi
done
if [ $nr_nsid -eq 0 ] ; then
echo "No namespaces found"
return 1
fi
}

declare -A NS_DEV_FAULT_INJECT_SAVE
declare -A CTRL_DEV_FAULT_INJECT_SAVE

Expand Down

0 comments on commit ce61317

Please sign in to comment.