Skip to contentSkip to conversation

iotests: 147: Don't test inet6 if not available

PATCH Applied Fam Zheng 3 participants 8 messages May 5, 2017 – May 17, 2017

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 iotests: 147: Don't test inet6 if not available

This is the case in our docker tests, as we use --net=none there. Skip this method.

---
 tests/qemu-iotests/147 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qemu-iotests/147 +7 -0
index 32afea6..db34838 100755
@@ -147,6 +147,13 @@ class BuiltinNBD(NBDBlockdevAddBase):
         self._server_down()
 
     def test_inet6(self):
+        try:
+            socket.getaddrinfo("::0", "0", socket.AF_INET6,
+                               socket.SOCK_STREAM, socket.IPPROTO_TCP,
+                               socket.AI_ADDRCONFIG | socket.AI_CANONNAME)
+        except socket.gaierror:
+            # IPv6 not available, skip
+            return
         address = { 'type': 'inet',
                     'data': {
                         'host': '::1',
Signature · 1 line
2.9.3
#1 lore raw
Quoted 13 lines · Fam Zheng

This is the case in our docker tests, as we use --net=none there. Skip this method.

---
 tests/qemu-iotests/147 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qemu-iotests/147 +0 -0
index 32afea6..db34838 100755

tests/qemu-iotests/147 class BuiltinNBD(NBDBlockdevAddBase): · line 156

Quoted 10 lines
tests/qemu-iotests/147 +7 -0
@@ -147,6 +147,13 @@ class BuiltinNBD(NBDBlockdevAddBase):
         self._server_down()
 
     def test_inet6(self):
+        try:
+            socket.getaddrinfo("::0", "0", socket.AF_INET6,
+                               socket.SOCK_STREAM, socket.IPPROTO_TCP,
+                               socket.AI_ADDRCONFIG | socket.AI_CANONNAME)
+        except socket.gaierror:
+            # IPv6 not available, skip
+            return

FWIW, in test-io-channel-socket.c we call getaddrinfo() and also check bind() succeeds (use port==0 to let it select a free port to test bind on), before assuming IPv6 is working.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author
#3 lore raw
In reply to Fam Zheng
Quoted 2 lines · Fam Zheng

This is the case in our docker tests, as we use --net=none there. Skip this method.

Ping. Is this patch okay?

Quoted 28 lines
---
 tests/qemu-iotests/147 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qemu-iotests/147 +7 -0
index 32afea6..db34838 100755
@@ -147,6 +147,13 @@ class BuiltinNBD(NBDBlockdevAddBase):
         self._server_down()
 
     def test_inet6(self):
+        try:
+            socket.getaddrinfo("::0", "0", socket.AF_INET6,
+                               socket.SOCK_STREAM, socket.IPPROTO_TCP,
+                               socket.AI_ADDRCONFIG | socket.AI_CANONNAME)
+        except socket.gaierror:
+            # IPv6 not available, skip
+            return
         address = { 'type': 'inet',
                     'data': {
                         'host': '::1',
Signature · 1 line
2.9.3
#4 lore raw

Am 17.05.2017 um 04:13 hat Fam Zheng geschrieben:

Quoted 5 lines · Fam Zheng
Quoted 2 lines

This is the case in our docker tests, as we use --net=none there. Skip this method.

Ping. Is this patch okay?

I thought you might want to respond to Dan's comment. If you don't plan to make the change he suggests, let me know and I'll queue the patch as it is.

Kevin

author
#5 lore raw
Quoted 10 lines · Kevin Wolf

Am 17.05.2017 um 04:13 hat Fam Zheng geschrieben:

Quoted 5 lines · Fam Zheng
Quoted 2 lines

This is the case in our docker tests, as we use --net=none there. Skip this method.

Ping. Is this patch okay?

I thought you might want to respond to Dan's comment. If you don't plan to make the change he suggests, let me know and I'll queue the patch as it is.

This check is enough for me and I think it's good to go.

Fam

#6 lore raw
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Kevin Wolf

Am 17.05.2017 um 04:13 hat Fam Zheng geschrieben:

Quoted 4 lines · Fam Zheng
Quoted 2 lines

This is the case in our docker tests, as we use --net=none there. Skip this method.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Ping. Is this patch okay?

I thought you might want to respond to Dan's comment. If you don't plan to make the change he suggests, let me know and I'll queue the patch as it is.

This check is enough for me and I think it's good to go.

That's fine with me - i didn't intend my comments to be a blocker. In general getaddrinfo should only return IPv6 addrs, if IPv6 is actually usable.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
author
#2 lore raw
In reply to Daniel P. Berrange
Quoted 16 lines · Daniel P. Berrange
Quoted 15 lines · Fam Zheng

This is the case in our docker tests, as we use --net=none there. Skip this method.

---
 tests/qemu-iotests/147 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qemu-iotests/147 +0 -0
index 32afea6..db34838 100755
@@ -147,6 +147,13 @@ class BuiltinNBD(NBDBlockdevAddBase):
         self._server_down()
 
Quoted 12 lines

tests/qemu-iotests/147 class BuiltinNBD(NBDBlockdevAddBase): · line 156

Quoted 8 lines
tests/qemu-iotests/147 +7 -0
     def test_inet6(self):
+        try:
+            socket.getaddrinfo("::0", "0", socket.AF_INET6,
+                               socket.SOCK_STREAM, socket.IPPROTO_TCP,
+                               socket.AI_ADDRCONFIG | socket.AI_CANONNAME)
+        except socket.gaierror:
+            # IPv6 not available, skip
+            return

FWIW, in test-io-channel-socket.c we call getaddrinfo() and also check bind() succeeds (use port==0 to let it select a free port to test bind on), before assuming IPv6 is working.

Well it then sounds like we should check bind(port=NBD_PORT). But if we do that, it looks like a slightly bigger topic, for example a previous run not cleanup?

Let's leave it for now.

Fam