mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 1 | def check_diskspace(host, path, gb): |
mbligh | c9585ec | 2008-03-05 18:28:39 +0000 | [diff] [blame] | 2 | df = host.run('df -mP %s | tail -1' % path).stdout.split() |
mbligh | 0ff7c22 | 2008-02-08 16:51:58 +0000 | [diff] [blame] | 3 | free_space_gb = int(df[3])/1000.0 |
mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 4 | if free_space_gb < gb: |
mbligh | 0ff7c22 | 2008-02-08 16:51:58 +0000 | [diff] [blame] | 5 | raise AutoservHostError('Not enough free space on ' + |
| 6 | '%s - %.3fGB free, want %.3fGB' % |
| 7 | (path, free_space_gb, gb)) |
mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 8 | |
| 9 | |
mbligh | ed5a410 | 2007-11-20 00:46:41 +0000 | [diff] [blame] | 10 | # This needs more stuff in it. Check for diskspace, etc. But it's a start. |
| 11 | def verify(machine): |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 12 | print 'Initializing host ' + machine |
jadmanski | 8d631c9 | 2008-08-18 21:12:40 +0000 | [diff] [blame^] | 13 | host = hosts.create_host(machine, initialize=False) |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 14 | print 'Pinging host ' + machine |
| 15 | sys.stdout.flush() |
mbligh | ed5a410 | 2007-11-20 00:46:41 +0000 | [diff] [blame] | 16 | host.ssh_ping() |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 17 | print 'Getting autodir for ' + machine |
mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 18 | autodir = None |
| 19 | try: |
| 20 | autodir = autotest._get_autodir(host) |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 21 | if autodir: |
mbligh | 0ff7c22 | 2008-02-08 16:51:58 +0000 | [diff] [blame] | 22 | print 'Checking diskspace for %s on %s' % (machine, |
| 23 | autodir) |
mbligh | 52c0a17 | 2008-01-26 22:54:25 +0000 | [diff] [blame] | 24 | check_diskspace(host, autodir, 20) |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 25 | except AutoservHostError: |
| 26 | raise # only want to raise if it's a space issue |
mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 27 | except: |
mbligh | 6102a36 | 2007-12-19 15:50:50 +0000 | [diff] [blame] | 28 | pass # autotest dir may not exist, etc. ignore |
mbligh | ed5a410 | 2007-11-20 00:46:41 +0000 | [diff] [blame] | 29 | if "site_verify" in globals(): |
mbligh | 7f86e0b | 2007-11-24 19:45:07 +0000 | [diff] [blame] | 30 | site_verify(host) |
mbligh | ed5a410 | 2007-11-20 00:46:41 +0000 | [diff] [blame] | 31 | |
mbligh | 6437ff5 | 2008-04-17 15:24:38 +0000 | [diff] [blame] | 32 | job.parallel_simple(verify, machines, log=False) |