diskwatcher.tac: don't report negative timeleft

This commit is contained in:
Brian Warner 2008-08-07 10:34:33 -07:00
parent 7502971df6
commit f77af25ef7

View File

@ -160,10 +160,9 @@ class DiskWatcher(service.MultiService, resource.Resource):
growth = self.growth(timespan) growth = self.growth(timespan)
print name, total_avail_space, growth print name, total_avail_space, growth
if growth is not None: if growth is not None:
try:
timeleft = total_avail_space / growth
except ZeroDivisionError:
timeleft = None timeleft = None
if growth > 0:
timeleft = total_avail_space / growth
timespans.append( (name, timespan, growth, timeleft) ) timespans.append( (name, timespan, growth, timeleft) )
return timespans return timespans