Change wait parameter for ping command
While testing new Cirros 0.5.1 withing our gates I found that
ping command, that is used for check IPv4 addresses, at first
time tries to resolve DNS AAAA records instead A. It costs
about 15 seconds.
Starting from Cirros 0.5.1 the command produced by InternalDNS Test [1] started to fail:
'ping -c1 -w1 -s56 leia'
For Cirros 0.4.0 the same command returned True.
For both cases ping tries first to resolv IPv6 address, then IPv4, even when
ping command is specified. For both cases tcpdump from instance looks like:
10:23:56.012171 IP 10.1.0.11.59861 > 8.8.8.8.53: 2+ AAAA? leia.openstackgate.local. (42)
10:24:01.018773 IP 10.1.0.11.46119 > 8.8.8.8.53: 3+ AAAA? leia.openstackgate.local. (42)
10:24:06.025143 IP 10.1.0.11.37590 > 8.8.8.8.53: 4+ AAAA? leia.openstackgate.local. (42)
10:24:11.032282 IP 10.1.0.11.57269 > 8.8.8.8.53: 5+ A? leia.openstackgate.local. (42)
10:24:11.033211 IP 8.8.8.8.53 > 10.1.0.11.57269: 5- 1/0/0 A 10.1.0.4 (82)
As we see the answer from Internal DNS is sent immediately after A? request is send.
Unfornutely for now the same ping for Cirros 0.5.1 fails.
We can workaround the problem by changing the '-w' ping parameter to '-W'.
From Cirros ping help page:
-W SEC Seconds to wait for the first response (default:10)
(after all -c CNT packets are sent)
-w SEC Seconds until ping exits (default:infinite)
(can exit earlier with -c CNT)
With that change the tests started to work.
[1] https://github.com/openstack/neutron-tempest-plugin/blob/3fcdb0689b542386632dbdbebe3b4b25fb779319/neutron_tempest_plugin/scenario/test_internal_dns.py#L79
Change-Id: I1c865770c8b58b0f080acb715baee4a9c92efd0c
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index fa91b31..dd91130 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -332,7 +332,7 @@
mtu=mtu, ip_version=ip_version))
if pattern:
cmd += ' -p {pattern}'.format(pattern=pattern)
- cmd += ' -c{0} -w{0} -s{1} {2}'.format(count, size, host)
+ cmd += ' -c{0} -W{0} -s{1} {2}'.format(count, size, host)
return source.exec_command(cmd)
def ping_remote():