blob: 4fdd64b70fc42a2658cb66d8b5355028cc519dcf [file] [log] [blame]
mbligh7f86e0b2007-11-24 19:45:07 +00001def check_diskspace(host, path, gb):
2 df = host.run('df -m %s | tail -1' % path).stdout.split()
3 free_space_gb = int(df[3])/1000
4 if free_space_gb < gb:
mbligh03f4fc72007-11-29 20:56:14 +00005 raise AutoservHostError('Not enough free space on %s - %dGB free, want %dGB' % (path, free_space_gb, gb))
mbligh7f86e0b2007-11-24 19:45:07 +00006
7
mblighed5a4102007-11-20 00:46:41 +00008# This needs more stuff in it. Check for diskspace, etc. But it's a start.
9def verify(machine):
mbligh6102a362007-12-19 15:50:50 +000010 print 'Initializing host ' + machine
mblighed5a4102007-11-20 00:46:41 +000011 host = hosts.SSHHost(machine, initialize=False)
mbligh6102a362007-12-19 15:50:50 +000012 print 'Pinging host ' + machine
13 sys.stdout.flush()
mblighed5a4102007-11-20 00:46:41 +000014 host.ssh_ping()
mbligh6102a362007-12-19 15:50:50 +000015 print 'Getting autodir for ' + machine
mbligh7f86e0b2007-11-24 19:45:07 +000016 autodir = None
17 try:
18 autodir = autotest._get_autodir(host)
mbligh6102a362007-12-19 15:50:50 +000019 if autodir:
20 print 'Checking diskspace for %s on %s' % (machine, autodir)
21 check_diskspace(host, autodir, 100)
22 except AutoservHostError:
23 raise # only want to raise if it's a space issue
mbligh7f86e0b2007-11-24 19:45:07 +000024 except:
mbligh6102a362007-12-19 15:50:50 +000025 pass # autotest dir may not exist, etc. ignore
mblighed5a4102007-11-20 00:46:41 +000026 if "site_verify" in globals():
mbligh7f86e0b2007-11-24 19:45:07 +000027 site_verify(host)
mblighed5a4102007-11-20 00:46:41 +000028
mbligh7f86e0b2007-11-24 19:45:07 +000029if len(machines) > 1:
30 parallel_simple(verify, machines, log=False)
31else:
32 verify(machines[0])