The ping command on that helper uses the options -c1 (count=1) and -w1 (deadline=1),
```
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count
packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits
with code 0. This makes it possible to use the exit code to see if a host is alive or not.
````
if the pings deson't receive 1 replay in 1 second the subprocess returns a returncode == 1 and makes the test fail
def ping_ip_address(self, ip_address, should_succeed=True, ping_timeout=None, mtu=None):
# the code is taken from tempest/scenario/manager.py in tempest git
timeout = ping_timeout or CONF.validation.ping_timeout
cmd = ['ping', '-c1', '-w1']
if mtu:
cmd += [
# don't fragment '-M', 'do',
# ping receives just the size of ICMP payload '-s', str(net_utils.get_ping_payload_size(mtu, 4))
] cmd.append(ip_address)
The ping command on that helper uses the options -c1 (count=1) and -w1 (deadline=1),
```
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count
packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits
with code 0. This makes it possible to use the exit code to see if a host is alive or not.
````
if the pings deson't receive 1 replay in 1 second the subprocess returns a returncode == 1 and makes the test fail
def ping_ip_ address( self, ip_address, should_ succeed= True,
ping_ timeout= None, mtu=None): scenario/ manager. py in tempest git .ping_timeout
# the code is taken from tempest/
timeout = ping_timeout or CONF.validation
cmd = ['ping', '-c1', '-w1']
if mtu:
'-M', 'do',
'-s', str(net_ utils.get_ ping_payload_ size(mtu, 4))
cmd.append( ip_address)
cmd += [
# don't fragment
# ping receives just the size of ICMP payload
]
def ping(): Popen(cmd,
stdout= subprocess. PIPE,
stderr= subprocess. PIPE)
proc. communicate( )
proc = subprocess.
return (proc.returncode == 0) == should_succeed