Skip to contentSkip to conversation

iotests: Stop NBD server in test 162 before starting the next one

PATCH In review Thomas Huth 2 participants 4 messages Feb 25, 2025 – Mar 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests: Stop NBD server in test 162 before starting the next one

Test 162 recently started failing for me for no obvious reasons (I did not spot any suspicious commits in this area), but looking in the 162.out.bad log file, there was a suspicious message at the end:

qemu-nbd: Cannot lock pid file: Resource temporarily unavailable

And indeed, the test starts the NBD server two times, without stopping the first server before running the second one, so the second one can indeed fail to lock the PID file. Thus let's make sure to stop the first server before the test continues with the second one. With this change, the test works fine for me again.

---
 tests/qemu-iotests/162 | 1 +
 1 file changed, 1 insertion(+)
tests/qemu-iotests/162 +1 -0
index 94dae60d304..956c2c5f339 100755
@@ -65,6 +65,7 @@ done
 
 $QEMU_IMG info "json:{'driver': 'nbd', 'host': 'localhost', 'port': $port}" \
     | grep '^image' | sed -e "s/$port/PORT/"
+_stop_nbd_server
 
 # This is a test for NBD's bdrv_refresh_filename() implementation: It expects
 # either host or path to be set, but it must not assume that they are set to
Signature · 1 line
2.48.1
#1 lore raw
Quoted 22 lines · Thomas Huth

Test 162 recently started failing for me for no obvious reasons (I did not spot any suspicious commits in this area), but looking in the 162.out.bad log file, there was a suspicious message at the end:

qemu-nbd: Cannot lock pid file: Resource temporarily unavailable

And indeed, the test starts the NBD server two times, without stopping the first server before running the second one, so the second one can indeed fail to lock the PID file. Thus let's make sure to stop the first server before the test continues with the second one. With this change, the test works fine for me again.

---
  tests/qemu-iotests/162 | 1 +
  1 file changed, 1 insertion(+)
tests/qemu-iotests/162 +0 -0
index 94dae60d304..956c2c5f339 100755

tests/qemu-iotests/162 done · line 71

Quoted 7 lines
tests/qemu-iotests/162 +1 -0
@@ -65,6 +65,7 @@ done
 
  $QEMU_IMG info "json:{'driver': 'nbd', 'host': 'localhost', 'port': $port}" \
      | grep '^image' | sed -e "s/$port/PORT/"
+_stop_nbd_server
 
  # This is a test for NBD's bdrv_refresh_filename() implementation: It expects
  # either host or path to be set, but it must not assume that they are set to

By the way, this problem also seems to be caused by running configure with --enable-trace-backends=simple ... but I think stopping the previous server before running the next one is still a good idea.

Thomas

Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 12 lines · Thomas Huth

Test 162 recently started failing for me for no obvious reasons (I did not spot any suspicious commits in this area), but looking in the 162.out.bad log file, there was a suspicious message at the end:

qemu-nbd: Cannot lock pid file: Resource temporarily unavailable

And indeed, the test starts the NBD server two times, without stopping the first server before running the second one, so the second one can indeed fail to lock the PID file. Thus let's make sure to stop the first server before the test continues with the second one. With this change, the test works fine for me again.

Quoted 4 lines
---
 tests/qemu-iotests/162 | 1 +
 1 file changed, 1 insertion(+)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
#3 lore raw
Quoted 13 lines · Eric Blake
Quoted 12 lines · Thomas Huth

Test 162 recently started failing for me for no obvious reasons (I did not spot any suspicious commits in this area), but looking in the 162.out.bad log file, there was a suspicious message at the end:

qemu-nbd: Cannot lock pid file: Resource temporarily unavailable

And indeed, the test starts the NBD server two times, without stopping the first server before running the second one, so the second one can indeed fail to lock the PID file. Thus let's make sure to stop the first server before the test continues with the second one. With this change, the test works fine for me again.

Quoted 6 lines
Quoted 4 lines
---
 tests/qemu-iotests/162 | 1 +
 1 file changed, 1 insertion(+)

Added to my NBD queue.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org