/[svn.andrew.net.au]/usbspindownd/usbspindownd.py
ViewVC logotype

Diff of /usbspindownd/usbspindownd.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by apollock, Thu Jan 31 19:06:27 2008 UTC revision 36 by apollock, Thu Jan 31 19:22:32 2008 UTC
# Line 153  def monitor_disks(config, options): Line 153  def monitor_disks(config, options):
153              debug(options, "Disk eligible for spinning down")              debug(options, "Disk eligible for spinning down")
154              # We can spin this disk down              # We can spin this disk down
155              if not config[disk]["spun_down"]:              if not config[disk]["spun_down"]:
156                if spin_down(disk):                if spin_down(options, disk):
157                  debug(options, "Disk spun down")                  debug(options, "Disk spun down")
158                  config[disk]["spun_down"] = True                  config[disk]["spun_down"] = True
159                else:                else:
# Line 164  def monitor_disks(config, options): Line 164  def monitor_disks(config, options):
164              # This disk is ineligible for spinning down at this time              # This disk is ineligible for spinning down at this time
165              debug(options, "Disk idle for %s seconds, but not for long enough (%s)" % (now - config[disk]["timestamp"], config[disk]["wait"]))              debug(options, "Disk idle for %s seconds, but not for long enough (%s)" % (now - config[disk]["timestamp"], config[disk]["wait"]))
166          else:          else:
           debug(options, "Disk not idle (old msio: %s, current msio: %s)" % (config[disk]["last_msio"], msio))  
167            config[disk]["last_msio"] = msio            config[disk]["last_msio"] = msio
168            config[disk]["timestamp"] = int(time.time())            config[disk]["timestamp"] = int(time.time())
169            config[disk]["spun_down"] = False            if config[disk]["spun_down"]:
170                debug(options, "%s presumed spun back up by activity" % (disk))
171                config[disk]["spun_down"] = False
172              debug(options, "Disk not idle (old msio: %s, current msio: %s)" % (config[disk]["last_msio"], msio))
173      debug(options, "Sleeping")      debug(options, "Sleeping")
174      time.sleep(60)      time.sleep(60)
175    debug(options, "Shutting down")    debug(options, "Shutting down")

Legend:
Removed from v.35  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.22