blob: c2b9336e62ea3e132aaf5dd341810426e9b5878d [file] [log] [blame]
def check_diskspace(host, path, gb):
df = host.run('df -mP %s | tail -1' % path).stdout.split()
free_space_gb = int(df[3])/1000.0
if free_space_gb < gb:
raise AutoservHostError('Not enough free space on ' +
'%s - %.3fGB free, want %.3fGB' %
(path, free_space_gb, gb))
# This needs more stuff in it. Check for diskspace, etc. But it's a start.
def verify(machine):
print 'Initializing host ' + machine
host = hosts.SSHHost(machine, initialize=False)
print 'Pinging host ' + machine
sys.stdout.flush()
host.ssh_ping()
print 'Getting autodir for ' + machine
autodir = None
try:
autodir = autotest._get_autodir(host)
if autodir:
print 'Checking diskspace for %s on %s' % (machine,
autodir)
check_diskspace(host, autodir, 20)
except AutoservHostError:
raise # only want to raise if it's a space issue
except:
pass # autotest dir may not exist, etc. ignore
if "site_verify" in globals():
site_verify(host)
job.parallel_simple(verify, machines, log=False)