Skip to contentSkip to conversation

iotests/277: Use iotests.sock_dir for socket creation

PATCH Applied Andrey Drobyshev 4 participants 5 messages Jan 24, 2024 – Jan 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests/277: Use iotests.sock_dir for socket creation

If socket path is too long (longer than 108 bytes), socket can't be opened. This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoid such a case.

This commit basically aligns iotests/277 with the rest of iotests.

---
 tests/qemu-iotests/277 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qemu-iotests/277 +2 -1
index 24833e7eb6..4224202ac2 100755
@@ -27,7 +27,8 @@ from iotests import file_path, log
 iotests.script_initialize()
 
 
-nbd_sock, conf_file = file_path('nbd-sock', 'nbd-fault-injector.conf')
+conf_file = file_path('nbd-fault-injector.conf')
+nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
 
 
 def make_conf_file(event):
Signature · 1 line
2.39.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andrey Drobyshev

If socket path is too long (longer than 108 bytes), socket can't be opened. This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoid such a case.

This commit basically aligns iotests/277 with the rest of iotests.

---
 tests/qemu-iotests/277 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 18 lines
tests/qemu-iotests/277 +2 -1
index 24833e7eb6..4224202ac2 100755
@@ -27,7 +27,8 @@ from iotests import file_path, log
 iotests.script_initialize()
 
 
-nbd_sock, conf_file = file_path('nbd-sock', 'nbd-fault-injector.conf')
+conf_file = file_path('nbd-fault-injector.conf')
+nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
 
 
 def make_conf_file(event):
Signature · 1 line
2.39.3
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
#2 lore raw
Quoted 26 lines · Eric Blake
Quoted 10 lines · Andrey Drobyshev

If socket path is too long (longer than 108 bytes), socket can't be opened. This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoid such a case.

This commit basically aligns iotests/277 with the rest of iotests.

---
  tests/qemu-iotests/277 | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines
tests/qemu-iotests/277 +2 -1
index 24833e7eb6..4224202ac2 100755
@@ -27,7 +27,8 @@ from iotests import file_path, log
  iotests.script_initialize()
 
 
-nbd_sock, conf_file = file_path('nbd-sock', 'nbd-fault-injector.conf')
+conf_file = file_path('nbd-fault-injector.conf')
+nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
 
 
Quoted 4 lines
Quoted 4 lines
tests/qemu-iotests/277 +0 -0
  def make_conf_file(event):
Signature · 1 line
2.39.3

I would say that potentially the same code is present
in 264, it is :
disk_a, disk_b, nbd_sock = file_path('disk_a', 'disk_b', 'nbd-sock') nbd_uri = 'nbd+unix:///?socket=' + nbd_sock

#3 lore raw
Quoted 24 lines · Denis V. Lunev
Quoted 23 lines · Eric Blake
Quoted 10 lines · Andrey Drobyshev

If socket path is too long (longer than 108 bytes), socket can't be opened.  This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoid such a case.

This commit basically aligns iotests/277 with the rest of iotests.

---
  tests/qemu-iotests/277 | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 10 lines
tests/qemu-iotests/277 +2 -0
index 24833e7eb6..4224202ac2 100755
@@ -27,7 +27,8 @@ from iotests import file_path, log
   iotests.script_initialize()
     -nbd_sock, conf_file = file_path('nbd-sock',
 'nbd-fault-injector.conf')
+conf_file = file_path('nbd-fault-injector.conf')
+nbd_sock = file_path('nbd-sock', base_dir=iotests.sock_dir)
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

      def make_conf_file(event):
--
2.39.3

I would say that potentially the same code is present
in 264, it is :
disk_a, disk_b, nbd_sock = file_path('disk_a', 'disk_b', 'nbd-sock') nbd_uri = 'nbd+unix:///?socket=' + nbd_sock

Thanks, have just sent a separate fix for iotests/264. Haven't found any others.

Andrey

Applied
#4 lore raw
In reply to Andrey Drobyshev

Am 24.01.2024 um 17:22 hat Andrey Drobyshev geschrieben:

Quoted 7 lines

If socket path is too long (longer than 108 bytes), socket can't be opened. This might lead to failure when test dir path is long enough. Make sure socket is created in iotests.sock_dir to avoid such a case.

This commit basically aligns iotests/277 with the rest of iotests.

Thanks, applied to the block branch.

Kevin