Inside the remote host class, there's a method, check_uptime, that makes
reference to the ping() method. This method has some problems on its
implementation:
* It calls an external program, fping, which is not installed by
default on some distros (a similar call to ping would do a similar job
and with more confidence that we would have this installed)
* It assumes that it is installed under a particular path, which is not
the path where it is installed for some distros
Apparently the purpose of choosing a ping was to do a quick 'host is
up?' assessment, which could be done using the more generic method
is_up(), defined on the base host class, that would translate
accordingly depending on the implementation of remote host used. So I
believe it's preferable to use it.
Therefore, this patch gets rid of ping() altogether (I checked and we
don't seem to use it anywhere else) and replaces it by is_up().
Oh, yes - this was found while working on 0.11.0 and it is applicable
verbatim to trunk as well.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3611 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/remote.py b/server/hosts/remote.py
index aca43eb..967b648 100644
--- a/server/hosts/remote.py
+++ b/server/hosts/remote.py
@@ -206,21 +206,12 @@
self.tmp_dirs.remove(tmpdir)
- def ping(self):
- """
- Ping the remote system, and return whether it's available
- """
- fpingcmd = "%s -q %s" % ('/usr/bin/fping', self.hostname)
- rc = utils.system(fpingcmd, ignore_status = 1)
- return (rc == 0)
-
-
def check_uptime(self):
"""
Check that uptime is available and monotonically increasing.
"""
- if not self.ping():
- raise error.AutoservHostError('Client is not pingable')
+ if not self.is_up():
+ raise error.AutoservHostError('Client does not appear to be up')
result = self.run("/bin/cat /proc/uptime", 30)
return result.stdout.strip().split()[0]