- Using localhost was making the feature test too slow, due to use IPv6
by default in systems that has IPv6 enabled but not properly
configured. For example, strace shows several attempts to send data
to a socket, being droped when timed out:
sendto(4,
"W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"...,
84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1",
&sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4,
"W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"...,
84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1",
&sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4,
"W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"...,
84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1",
&sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
sendto(4,
"W\34\326\267\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\4\0\0\0\3\0\0\0\0\0\0\0\0"...,
84, 0, {sa_family=AF_INET6, sin6_port=htons(111), inet_pton(AF_INET6, "::1",
&sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 84
poll([{fd=4, events=POLLIN}], 1, 15000) = 0 (Timeout)
Both cases are similar:
* showmount --no-headers --exports localhost
* showmount --no-headers --exports ::1
So, passing 127.0.0.1 we are explicitly requiring a IPv4 connection
and that will speed up the feature test *as well as* return the
correct result, not a simply timeout:
sendto(4,
"W\37\256\365\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\2\0\0\0\3\0\0\0\0\0\0\0\0"...,
56, 0, {sa_family=AF_INET, sin_port=htons(111),
sin_addr=inet_addr("127.0.0.1")}, 16) = 56
poll([{fd=4, events=POLLIN}], 1, 15000) = 1 ([{fd=4, revents=POLLERR}])
recvmsg(4, {msg_name(16)={sa_family=AF_INET, sin_port=htons(111),
sin_addr=inet_addr("127.0.0.1")},
msg_iov(1)=[{"W\37\256\365\0\0\0\0\0\0\0\2\0\1\206\240\0\0\0\2\0\0\0\3\0\0\0\0\0\0\0\0"...,
56}], msg_controllen=48, [{cmsg_len=48, cmsg_level=SOL_IP, cmsg_type=IP_RECVERR,
{ee_errno=111, ee_origin=2, ee_type=3, ee_code=3, ee_info=0, ee_data=0,
offender={sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("127.0.0.1")}}}], msg_flags=MSG_ERRQUEUE}, MSG_ERRQUEUE) =
56
Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
model/featuretests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/model/featuretests.py b/model/featuretests.py
index 23e7eeb..2b680c3 100644
--- a/model/featuretests.py
+++ b/model/featuretests.py
@@ -148,7 +148,7 @@ class FeatureTests(object):
@staticmethod
def libvirt_support_nfs_probe(conn):
def _get_xml():
- obj = E.source(E.host(name='localhost'),
E.format(type='nfs'))
+ obj = E.source(E.host(name='127.0.0.1'),
E.format(type='nfs'))
xml = ET.tostring(obj)
return xml
try:
--
1.9.1